Local workspace file (‘angular.json’) could not be found.

The following error was reported while running ng serve

Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.
    at WorkspaceLoader._getProjectWorkspaceFilePath (D:\nodejs\node_global\node_modules\@angular\cli\models\workspace-loader.js:44:
19)
    at WorkspaceLoader.loadWorkspace (D:\nodejs\node_global\node_modules\@angular\cli\models\workspace-loader.js:31:21)
    at ServeCommand._loadWorkspaceAndArchitect (D:\nodejs\node_global\node_modules\@angular\cli\models\architect-command.js:201:32)
    at ServeCommand.<anonymous> (D:\nodejs\node_global\node_modules\@angular\cli\models\architect-command.js:53:25)
    at Generator.next (<anonymous>)
    at D:\nodejs\node_global\node_modules\@angular\cli\models\architect-command.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (D:\nodejs\node_global\node_modules\@angular\cli\models\architect-command.js:3:12)
    at ServeCommand.initialize (D:\nodejs\node_global\node_modules\@angular\cli\models\architect-command.js:52:16)
    at Object.<anonymous> (D:\nodejs\node_global\node_modules\@angular\cli\models\command-runner.js:127:23)

Error cause: Possible angular/ CLI version mismatch
Solutions:
Upgrade presents/cli
Uninstall Angular/CLI globally

npm uninstall -g @angular/cli

2. Clean up

npm cache verify

Install Angular/CLI globally

npm install -g @angular/cli@latest

4. Uninstall Angluar/CLI under the project path

npm uninstall --save-dev @angular/cli

5. Install under the project path:

npm install --save-dev @angular/[email protected]

6. NPM install or YARN Install under the project path
7. Fix the problem after NPM installation:

npm audit fix

8. Resolve “Angular. Json” related issues:

ng update @angular/cli --migrate-only --from=1.4.9

 

Reproduced in: https://www.cnblogs.com/shira-t/p/9759142.html

Read More: