Angular-cli: Error: Local workspace file ('angular.json') could not be found.

Created on 6 Jun 2018  路  9Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Area

- [x] devkit
- [ ] schematics

Versions


Angular CLI: 6.0.8
Node: 8.11.2
OS: win32 x64
Angular: 6.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cli 6.0.8
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.2.0
typescript 2.7.2
webpack 4.8.3

Windows 7 x64

Repro steps


In VS Code Integrated Terminal:
ng new sample

Then:
npm install --save @ng-bootstrap/ng-bootstrap

And then:
ng serve --open

The log given by the failure


Error: Local workspace file ('angular.json') could not be found. Error: Local workspace file ('angular.json') could not be found. at WorkspaceLoader._getProjectWorkspaceFilePath (C:\Users\[username]\AppData\Roaming\npm\node_modules\@angular\cli\models\workspace-loader.js:37:19) at WorkspaceLoader.loadWorkspace (C:\Users\[username]\AppData\Roaming\npm\node_modules\@angular\cli\models\workspace-loader.js:24:21) at ServeCommand._loadWorkspaceAndArchitect (C:\Users\[username]\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:180:32) at ServeCommand.<anonymous> (C:\Users\[username]\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:47:25) at Generator.next (<anonymous>) at C:\Users\[username]\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:7:71 at new Promise (<anonymous>) at __awaiter (C:\Users\[username]\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:3:12) at ServeCommand.initialize (C:\Users\[username]\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:46:16) at Object.<anonymous> (C:\Users\[username]\AppData\Roaming\npm\node_modules\@angular\cli\models\command-runner.js:87:23)

Desired functionality


It should open the browser and show the running angular app

Mention any other details that might be useful

repro steps

Most helpful comment

You have to run ng serve --open in the same folder that creates your project. In your case the folder sample

All 9 comments

Hi, I can't see that behaviour when following your repro. Can you provide a repository where this happens please?

Just to confirm though, did you change directory into sample after ng new? Because if you didn't, you're still outside of the project and not serving anything.

You have to run ng serve --open in the same folder that creates your project. In your case the folder sample

The steps are all fine except you have to do one more step to run the angular application.
Pls change the directory >cd sample
and then run the command >ng serve
Hope this will create the initial environment successfully.

For people googling this error. It鈥檚 probably because your global @angular/cli version and @angular/compiler-cli are differentf here is how to fix it (my blog).

This is because you have install angular in some directory and trying to use ng serve without creating your new project set-up
Generating and serving an Angular project via a development server
ng new PROJECT-NAME
cd PROJECT-NAME
ng serve
https://www.npmjs.com/package/@angular/cli#generating-and-serving-an-angular-project-via-a-development-server

I am facing following error:

Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.
at WorkspaceLoader._getProjectWorkspaceFilePath (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules\@angular\cli\models\workspace-loader.js:44:19)
at WorkspaceLoader.loadWorkspace (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules\@angular\cli\models\workspace-loader.js:31:21)
at ServeCommand._loadWorkspaceAndArchitect (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules\@angular\cli\models\architect-command.js:201:32)
at ServeCommand. (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules\@angular\cli\models\architect-command.js:53:25)
at Generator.next ()
at F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules\@angular\cli\models\architect-command.js:7:71
at new Promise ()
at __awaiter (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules\@angular\cli\models\architect-command.js:3:12)
at ServeCommand.initialize (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules\@angular\cli\models\architect-command.js:52:16)
at Object. (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules\@angular\cli\models\command-runner.js:127:23)

I am facing following error:

Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.
at WorkspaceLoader._getProjectWorkspaceFilePath (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules@angular\cli\models\workspace-loader.js:44:19)
at WorkspaceLoader.loadWorkspace (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules@angular\cli\models\workspace-loader.js:31:21)
at ServeCommand._loadWorkspaceAndArchitect (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules@angular\cli\models\architect-command.js:201:32)
at ServeCommand. (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules@angular\cli\models\architect-command.js:53:25)
at Generator.next ()
at F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules@angular\cli\models\architect-command.js:7:71
at new Promise ()
at __awaiter (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules@angular\cli\models\architect-command.js:3:12)
at ServeCommand.initialize (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules@angular\cli\models\architect-command.js:52:16)
at Object. (F:\Angular Projects\coreui-free-bootstrap-admin-template-master\node_modules@angular\cli\models\command-runner.js:127:23)

I'm having the same issue

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

5amfung picture 5amfung  路  3Comments

daBishMan picture daBishMan  路  3Comments

MateenKadwaikar picture MateenKadwaikar  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments