Sma*_*EGA 3 angular-cli angular
我在一台计算机上遇到以下错误,但它可以在另一台计算机上使用相同的源代码
找不到本地工作区文件('angular.json').错误:找不到本地工作区文件('angular.json')
不工作的电脑
工作电脑
我尝试了这个stackoverflow链接中提到的命令,但没有运气
ng update @ angular/cli --migrate-only --from = 1.7.4这删除了.angular-cli.json并创建了angular.json.
如果这导致您的项目使用1.7.4,请在本地安装v6:
npm install --save-dev @ angular/cli @ v6.0.0-rc.4
不工作的计算机版本
PS D:\ Work\Source> ng -v您的全局Angular CLI版本(6.0.8)大于本地版本(6.0.0-rc.4).使用本地Angular CLI版本.
要禁用此警告,请使用"ng config -g cli.warnings.versionMismatch false".
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
Run Code Online (Sandbox Code Playgroud)
/△\ | '_\/ _ | | | | |/ _| ' | | | | | | | /\ | | | | ( | | | | | |( | | | | | | | | | |/| __ | | | __,| __,| | __,| | ____ | _____ | | | /
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
Run Code Online (Sandbox Code Playgroud)
工作计算机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
Run Code Online (Sandbox Code Playgroud)
这可能是因为你的全局@ angular/cli,项目@ angular/cli版本或@ angular/compiler-cli不匹配.
调试这个
首先运行
ng -v
Run Code Online (Sandbox Code Playgroud)
要检查角度的全局版本,请将版本与角度项目版本进行比较.如果它与他们匹配或不.
如果某些内容不匹配,请更新或降级.例如,降级项目@ angular/cli run
npm uninstall -D @angular/cli
npm install -D @angular/cli@5.2.0
Run Code Online (Sandbox Code Playgroud)
升级全局运行@ angular/cli run
npm install -g @angular/cli@latest
Run Code Online (Sandbox Code Playgroud)
小智 7
另外,请确保您位于 angular.json 文件所在的文件夹中。这就是我的问题。哦!我在 cmd 窗口的父文件夹中,它不喜欢那样。将目录更改为项目文件夹为我解决了这个问题。某种“是否已插入”解决方案,但我想无论如何我都会分享它。