user2442818
user2442818

Reputation: 21

angular.json not found when trying to ng serve

I have an angular program and when I go to cmd and try to run it with ng serve, it gives me this message.
I tried to solve it in some ways i found on stack overflow but none of them work

It showed me this 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\omerb\AppData\Roaming\npm\node_modules\@angular\cli\models\workspace-loader.js:37:19)
    at WorkspaceLoader.loadWorkspace (C:\Users\omerb\AppData\Roaming\npm\node_modules\@angular\cli\models\workspace-loader.js:24:21)
    at ServeCommand._loadWorkspaceAndArchitect (C:\Users\omerb\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:180:32)
    at ServeCommand. (C:\Users\omerb\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:47:25)
    at Generator.next ()
    at C:\Users\omerb\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:7:71
    at new Promise ()
    at __awaiter (C:\Users\omerb\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:3:12)
    at ServeCommand.initialize (C:\Users\omerb\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:46:16)
    at Object. (C:\Users\omerb\AppData\Roaming\npm\node_modules\@angular\cli\models\command-runner.js:87:23)

Upvotes: 2

Views: 3137

Answers (3)

Melinda
Melinda

Reputation: 76

Another possible solution is that you are not running 'ng serve' in the actual folder of the project you are trying to view.

Upvotes: 0

snorberhuis
snorberhuis

Reputation: 3286

A different solution that solves many others problems is to recreate the project with the CLI:

ng new foo

Afterward, you merge the code with your current code. Using this approach solves any problems with an old state and allows you to start fresh. This procedure can be beneficial in updating the angular version.

Upvotes: 0

Talha Junaid
Talha Junaid

Reputation: 2415

In addition to @Adonis's answer It looks like you are using newer version of angular but project has not been updated. To update project to angular 6 follow guide given at angular website

Upvotes: 1

Related Questions