3

I am getting following error in one computer, but it works in another computer for the same source code

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

Not working computer

enter image description here

Working computer

enter image description here

I tried following commands mentioned in this stackoverflow link, but no luck

ng update @angular/cli --migrate-only --from=1.7.4 This removed .angular-cli.json and created angular.json.

If this leads to your project using 1.7.4, install v6 locally:

npm install --save-dev @angular/cli@v6.0.0-rc.4

Not working computer ng version

PS D:\Work\Source> ng -v Your global Angular CLI version (6.0.8) is greater than your local version (6.0.0-rc.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | '_ \ / _| | | | |/ _ | '| | | | | | | / \| | | | (| | || | | (| | | | || | | | // __| ||__, |__,||__,|| ____|_____|| |/

Angular CLI: 6.0.0-rc.4
Node: 8.11.3
OS: win32 x64
Angular: 5.2.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.5.6
@angular-devkit/core         0.5.6 (cli-only)
@angular-devkit/schematics   0.5.6 (cli-only)
@angular/cli                 6.0.0-rc.4
@ngtools/json-schema         1.2.0
@schematics/angular          0.5.6 (cli-only)
@schematics/update           0.5.6
rxjs                         5.5.10
typescript                   2.5.3

Working computer ng -version

PS V:\Jaison\Incomming\HISUI_Grid\HISUI\HISUI_04July2018\HISUI\src> ng -v
Your global Angular CLI version (6.0.8) is greater than your local
version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.7.4
Node: 8.9.3
OS: win32 x64
Angular: 5.2.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.4
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0
SmartestVEGA
  • 8,415
  • 26
  • 86
  • 139

2 Answers2

9

it’s probably because your global @angular/ cli, project @angular/cli version or @angular/compiler-cli doesn’t match.

Debugging this

first of all run

ng -v 

to check the global version of your angular, then compare the version with your angular project versions. if it matches with them or no.

If something doesn’t match, update or downgrade it. For example to downgrade project @angular/cli run

npm uninstall -D @angular/cli

npm install -D @angular/cli@5.2.0

To upgrade global run @angular/cli run

npm install -g @angular/cli@latest
Hrishikesh Kale
  • 6,140
  • 4
  • 18
  • 27
7

Also, make sure you're in the folder where the angular.json file is located. That's what my issue turned out to be. Doh! I was in the parent folder in the cmd window and it didn't like that. Changing directory to the project folder fixed the issue for me. Sort of an "is it plugged in" solution, but thought I'd share it anyway.

LReeder14
  • 608
  • 7
  • 10