关于 ng add @angular/cli 的问题
Issue on ng add @angular/cli
在项目根目录下执行ng add @angular/cli
时,报错:
The package that you are trying to add does not support schematics.
You can try using a different version of the package or contact the
package author to add ng-add support.
我的package.json:
{
"name": "app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular-devkit/schematics": "^8.0.0",
"@angular/animations": "^8.0.2",
"@angular/cdk": "^8.0.0",
"@angular/common": "^8.0.2",
"@angular/compiler": "^8.0.2",
"@angular/core": "^8.0.2",
"@angular/fire": "^5.2.1",
"@angular/forms": "^8.0.2",
"@angular/material": "^8.0.0",
"@angular/material-moment-adapter": "^8.0.0",
"@angular/platform-browser": "^8.0.2",
"@angular/platform-browser-dynamic": "^8.0.2",
"@angular/router": "^8.0.2",
"@asymmetrik/ngx-leaflet": "^5.0.2",
"@ngrx/data": "^8.0.1",
"@ngrx/effects": "^8.0.1",
"@ngrx/entity": "^8.0.1",
"@ngrx/router-store": "^8.1.0",
"@ngrx/store": "^8.0.1",
"@ngrx/store-devtools": "^8.0.1",
"@types/leaflet": "^1.4.7",
"body-parser": "^1.18.2",
"core-js": "^2.4.1",
"express": "^4.16.2",
"firebase": "^6.6.0",
"hammerjs": "^2.0.8",
"leaflet": "^1.5.1",
"leaflet-routing-machine": "^3.2.12",
"moment": "^2.22.2",
"rxjs": "^6.3.3",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.800.0",
"@angular/cli": "^8.0.1",
"@angular/compiler-cli": "^8.0.2",
"@angular/language-service": "^8.0.2",
"@ngrx/schematics": "^8.0.1",
"@types/express": "^4.0.39",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^5.0.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "^4.1.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"ngrx-store-freeze": "^0.2.4",
"protractor": "^6.0.0",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~3.4.5"
}
}
有什么提示吗?提前谢谢你。
你不添加@angular/cli到你的项目,你通过cmd或命令行安装它到你的系统,然后调用它来创建和启动应用程序。
npm install -g @angular/cli
ng new my-dream-app
cd my-dream-app
ng serve
这里是关于 angular cli 的官方文档:Angular Cli
这很奇怪...我也遇到过。
基本上,我只是重新安装(更新)了 Angular Cli。
然后对 firebase-tools 做同样的事情。
ng 新项目
在项目根目录 > ng 添加 @angular/fire
起初它给了我另一个错误(没有记录它,没想到)。
运行 命令再次响应:
"The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to add ng-add support."
所以我:
1 - 删除了项目。
2 - 重新启动计算机。
3 - ng new'ed anotherProject.
这次 ng add @angular/etc 工作正常。
如果一切都失败了,请按 cntrl-alt-del。这可能就足够了。
希望这些信息对某人有所帮助(因为我确定您现在已经重新启动了)。
在项目根目录下执行ng add @angular/cli
时,报错:
The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to add ng-add support.
我的package.json:
{
"name": "app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular-devkit/schematics": "^8.0.0",
"@angular/animations": "^8.0.2",
"@angular/cdk": "^8.0.0",
"@angular/common": "^8.0.2",
"@angular/compiler": "^8.0.2",
"@angular/core": "^8.0.2",
"@angular/fire": "^5.2.1",
"@angular/forms": "^8.0.2",
"@angular/material": "^8.0.0",
"@angular/material-moment-adapter": "^8.0.0",
"@angular/platform-browser": "^8.0.2",
"@angular/platform-browser-dynamic": "^8.0.2",
"@angular/router": "^8.0.2",
"@asymmetrik/ngx-leaflet": "^5.0.2",
"@ngrx/data": "^8.0.1",
"@ngrx/effects": "^8.0.1",
"@ngrx/entity": "^8.0.1",
"@ngrx/router-store": "^8.1.0",
"@ngrx/store": "^8.0.1",
"@ngrx/store-devtools": "^8.0.1",
"@types/leaflet": "^1.4.7",
"body-parser": "^1.18.2",
"core-js": "^2.4.1",
"express": "^4.16.2",
"firebase": "^6.6.0",
"hammerjs": "^2.0.8",
"leaflet": "^1.5.1",
"leaflet-routing-machine": "^3.2.12",
"moment": "^2.22.2",
"rxjs": "^6.3.3",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.800.0",
"@angular/cli": "^8.0.1",
"@angular/compiler-cli": "^8.0.2",
"@angular/language-service": "^8.0.2",
"@ngrx/schematics": "^8.0.1",
"@types/express": "^4.0.39",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^5.0.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "^4.1.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"ngrx-store-freeze": "^0.2.4",
"protractor": "^6.0.0",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~3.4.5"
}
}
有什么提示吗?提前谢谢你。
你不添加@angular/cli到你的项目,你通过cmd或命令行安装它到你的系统,然后调用它来创建和启动应用程序。
npm install -g @angular/cli
ng new my-dream-app
cd my-dream-app
ng serve
这里是关于 angular cli 的官方文档:Angular Cli
这很奇怪...我也遇到过。
基本上,我只是重新安装(更新)了 Angular Cli。 然后对 firebase-tools 做同样的事情。
ng 新项目 在项目根目录 > ng 添加 @angular/fire
起初它给了我另一个错误(没有记录它,没想到)。 运行 命令再次响应:
"The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to add ng-add support."
所以我: 1 - 删除了项目。 2 - 重新启动计算机。 3 - ng new'ed anotherProject.
这次 ng add @angular/etc 工作正常。
如果一切都失败了,请按 cntrl-alt-del。这可能就足够了。
希望这些信息对某人有所帮助(因为我确定您现在已经重新启动了)。