2

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)
user2442818
  • 21
  • 1
  • 2

3 Answers3

1

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

Talha Junaid
  • 2,351
  • 20
  • 29
0

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.

snorberhuis
  • 3,108
  • 2
  • 22
  • 29
0

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

Melinda
  • 76
  • 8