gpt4 book ai didi

javascript - 错误 : "@anuglar/compiler-cli" package was not properly installed

转载 作者:行者123 更新时间:2023-11-30 11:35:31 38 4
gpt4 key购买 nike

Angular 的新手并接手了另一个开发人员开始的项目。我已经安装了 Angular 并执行了 npm install 但我一直收到“@anuglar/compiler-cli”包未正确安装。到目前为止,这是我尝试过的:

  1. (a) npm install -g typescript 然后 (b) npm install - “ng serve”运气不好
  2. (a) npm uninstall --save-dev angular-cli (b) npm install --save-dev @angular/cli@latest; - “ng serve”不走运

终端错误:

Error: The "@angular/compiler-cli" package was not properly installed.
at Object.<anonymous> (/Users/Jack/Documents/Github/t-dashboard/node_modules/@ngtools/webpack/src/index.js:14:11)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/Jack/Documents/Github/t-dashboard/node_modules/@angular/cli/tasks/eject.js:10:19)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)

包.json

{
"name": "genesis-ui",
"version": "1.5.11",
"description": "Bootstrap 4 Admin Template",
"author": "",
"url": "https://genesisui.com",
"copyright": "Copyright 2016 creativeLabs Łukasz Holeczek",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.2.3",
"@angular/compiler": "2.2.3",
"@angular/core": "2.2.3",
"@angular/forms": "2.2.3",
"@angular/http": "2.2.3",
"@angular/platform-browser": "2.2.3",
"@angular/platform-browser-dynamic": "2.2.3",
"@angular/router": "3.2.3",
"@angular/upgrade": "2.2.3",
"@types/lodash": "4.14.40",
"angular-calendar": "0.4.0",
"angular2-datatable": "0.5.2",
"angular2-ladda": "^1.0.6",
"angular2-moment": "^1.1.0",
"angular2-toaster": "1.0.2",
"chart.js": "^2.3.0",
"core-js": "^2.4.0",
"date-fns": "1.10.0",
"moment": "^2.17.0",
"ng2-bootstrap": "^1.1.16",
"ng2-charts": "^1.4.4",
"ng2-select": "^1.1.2",
"ng2-timeago": "^1.0.6",
"rxjs": "5.0.0-rc.4",
"ts-helpers": "^1.1.2",
"zone.js": "0.7.2"
},
"devDependencies": {
"@types/jasmine": "^2.5.37",
"codelyzer": "1.0.0-beta.4",
"jasmine-core": "^2.5.2",
"jasmine-spec-reporter": "2.7.0",
"karma": "1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.11",
"ts-node": "1.7.0",
"tslint": "4.0.2",
"typescript": "2.3.4"
}
}

更新 1

感谢您的回复,但仍然遇到同样的问题。这是我使用的命令:

  1. npm i -S @angular/compiler-cli -> 添加了 "dependencies":{.., "@angular/compiler-cli": "^4.2.3",... 在 package.json 中
  2. npm i -D @angular/cli-> 添加了 "devDependencies":{..., "@angular/cli": "^1.1.2",.. .
  3. npm install -> 仍然出现相同的错误 - ““@angular/compiler-cli”包未正确安装。”
  4. 我想尝试将 complier-cli 安装到 devDependency。 npm i -S @angular/compiler-cli -> 添加了 "devDependencies":{..., "@angular/compiler-cli": "^1.1.2",. ..} 然后 npm 安装。

更新 2

npm install 上,我在执行过程中看到了一些警告。关于警告的全部内容的任何想法?npm WARN @angular/compiler-cli@4.2.3 需要 @angular/compiler@4.2.3 的对等体,但没有安装。
npm WARN @angular/compiler-cli@4.2.3 需要 @angular/core@4.2.3 的对等体,但没有安装。
npm WARN @angular/core@2.2.3 需要 rxjs@5.0.0-beta.12 的对等体,但没有安装。
npm WARN @angular/core@2.2.3 需要 zone.js@^0.6.21 的对等体,但没有安装。
npm WARN @angular/http@2.2.3 需要 rxjs@5.0.0-beta.12 的对等体,但没有安装。
npm WARN @angular/router@3.2.3 需要 rxjs@5.0.0-beta.12 的对等体,但没有安装。
npm WARN @ng-bootstrap/ng-bootstrap@1.0.0-alpha.26 需要 @angular/core@^4.0.3 的对等体,但没有安装。
npm WARN @ng-bootstrap/ng-bootstrap@1.0.0-alpha.26 需要 @angular/common@^4.0.3 的对等体,但没有安装。
npm WARN @ng-bootstrap/ng-bootstrap@1.0.0-alpha.26 需要 @angular/forms@^4.0.3 的对等体,但没有安装。
npm WARN angular2-ladda@1.2.1 需要 @angular/core@^4.0.0 的对等体,但没有安装。
npm WARN angular2-toaster@1.0.2 需要 rxjs@5.0.0-beta.12 的对等体,但没有安装。
npm WARN codelyzer@1.0.0-beta.4 需要 tslint@^3.9.0 的对等体,但没有安装。
npm WARN ng2-bootstrap@1.6.3 需要 @angular/common@^2.3.1 的对等体 || >=4.0.0 但没有安装。
npm WARN ng2-bootstrap@1.6.3 需要 @angular/compiler@^2.3.1 的对等体 || >=4.0.0 但没有安装。
npm WARN ng2-bootstrap@1.6.3 需要 @angular/core@^2.3.1 的对等体 || >=4.0.0 但没有安装。
npm WARN ng2-bootstrap@1.6.3 需要 @angular/forms@^2.3.1 的对等体 || >=4.0.0 但没有安装。
npm WARN ng2-charts@1.6.0 需要 @angular/common@^2.3.0 的对等体 || >=4.0.0 但没有安装。
npm WARN ng2-charts@1.6.0 需要 @angular/core@^2.3.0 的对等体 || >=4.0.0 但没有安装。
npm WARN ng2-select@1.2.0 需要 @angular/common@^2.3.0 的对等体,但没有安装。
npm WARN ng2-select@1.2.0 需要 @angular/core@^2.3.0 的对等体,但没有安装。

还是一样的错误。还有其他建议吗?提前致谢。

最佳答案

您缺少编译器 cli 包,只需重新安装即可

npm i -S @angular/compiler-cli

您的 package.json 似乎也缺少开发依赖项中的 angular cli,所以这样做

npm i -D @angular/cli

关于javascript - 错误 : "@anuglar/compiler-cli" package was not properly installed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44642036/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com