【发布时间】:2020-01-02 12:38:56
【问题描述】:
命令ng add angular/material @angular/cdk @angular/animations 导致以下错误消息:
您的全局 Angular CLI 版本 (8.3.1) 高于本地版本 版本(6.0.8)。使用本地 Angular CLI 版本。
要禁用此警告,请使用“ng config -g cli.warnings.versionMismatch 假”。
通过 npm 安装工具包。原理图/别名“安装” 与另一个别名或原理图名称冲突。错误:原理图/别名 “安装”与另一个别名或原理图名称冲突。 在 NodeModulesEngineHost.createCollectionDescription (D:\path\ClientApp\node_modules@angular-devkit\schematics\tools\file-system-engine-host-base.js:125:27) 在 SchematicEngine._createCollectionDescription (D:\path\ClientApp\node_modules@angular-devkit\schematics\src\engine\engine.js:78:40) 在 SchematicEngine.createCollection (D:\path\ClientApp\node_modules@angular-devkit\schematics\src\engine\engine.js:71:43) 在 Object.getCollection (D:\path\ClientApp\node_modules@angular\cli\utilities\schematics.js:28:31) 在 AddCommand.getOptions (D:\path\ClientApp\node_modules@angular\cli\models\schematic-command.js:193:41) 在 AddCommand。 (D:\path\ClientApp\node_modules@angular\cli\commands\add.js:30:49) 在 Generator.next () 在 D:\path\ClientApp\node_modules@angular\cli\commands\add.js:7:71 在新的承诺 () 在 __awaiter (D:\path\ClientApp\node_modules@angular\cli\commands\add.js:3:12)
这是我的 package.json(安装上述命令后):
{
"name": "PWA.web",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build:ssr": "ng run PWA.web:server:dev",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "6.1.10",
"@angular/common": "6.1.10",
"@angular/compiler": "6.1.10",
"@angular/core": "6.1.10",
"@angular/forms": "6.1.10",
"@angular/http": "6.1.10",
"@angular/platform-browser": "6.1.10",
"@angular/platform-browser-dynamic": "6.1.10",
"@angular/platform-server": "6.1.10",
"@angular/router": "6.1.10",
"@nguniversal/module-map-ngfactory-loader": "6.0.0",
"core-js": "^2.5.4",
"rxjs": "^6.0.0",
"zone.js": "^0.8.26",
"aspnet-prerendering": "^3.0.1",
"bootstrap": "^4.3.1",
"jquery": "3.3.1",
"popper.js": "^1.14.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.0",
"@angular/cli": "~6.0.0",
"@angular/compiler-cli": "6.1.10",
"@angular/language-service": "^6.0.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"typescript": "~2.7.2"
},
"optionalDependencies": {
"node-sass": "^4.9.3",
"protractor": "~5.4.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1"
}
}
更新 CLI 后,我在控制台中得到("Invalid rule result: Function()"), in the console:
λ ng update @angular/cli 您的全局 Angular CLI 版本 (8.3.1) 是 大于您的本地版本 (6.0.8)。本地 Angular CLI 版本 被使用了。
要禁用此警告,请使用“ng config -g cli.warnings.versionMismatch 错误的”。 包 @angular/cli 的 packageGroup 元数据格式错误。 包 @angular/cli 的 packageGroup 元数据格式错误。无视。 更新 package.json 依赖 @angular/cli @ "8.3.1" (原为 "6.0.8")...更新 package.json (1630 bytes)
@angular/cli@8.3.1 安装后 D:\path\ClientApp\node_modules@angular\cli 节点 ./bin/postinstall/script.js
npm WARN bootstrap@4.3.1 需要一个 popper.js@^1.14.7 但没有 已安装。您必须自己安装对等依赖项。 npm 警告 可选跳过可选依赖:fsevents@1.2.4 (node_modules\fsevents): npm WARN notsup 跳过可选依赖: fsevents@1.2.4 不受支持的平台:需要 {"os":"darwin","arch":"any"}(当前:{"os":"win32","arch":"x64"})
添加了来自 125 个贡献者的 157 个包,删除了 5 个包,更新了 5 包和审计 17353 包在 66.365s 发现 238 漏洞(2 低,14 中等,222 高)运行
npm audit fix修复它们,或npm audit了解详情 ** 为包“@angular/cli”执行迁移 ** 无效的规则结果:Function()。
再次执行ng add angular/material @angular/cdk @angular/animations后,控制台没有显示错误,但是当我启动项目时,我在网页上写了[error] Error: Could not find the implementation for builder @angular-devkit/build-angular:dev-server。
在此处查找完整的错误日志:
https://shrib.com/#V8wxfbAihcJi8Nszax7L
使用asp.net core 2.2,这里怎么办?
【问题讨论】:
-
您可以尝试更新您的 angular-cli 版本吗?
-
你从哪里得到新的错误?
标签: angular asp.net-core