Angular的新手并接管另一位开发人员启动的项目。我已经安装了Angular并且还执行了npm install但是我继续得到" @ anuglar / compiler-cli"包没有正确安装。 这是我到目前为止所做的:
终端错误:
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)
的package.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
回复的Thx,但仍然遇到同样的问题。 这是我使用的命令:
npm i -S @angular/compiler-cli
- &gt;其中在package.json "dependencies":{.., "@angular/compiler-cli": "^4.2.3",...}
npm i -D @angular/cli
- &GT;其中添加了"devDependencies":{..., "@angular/cli": "^1.1.2",...}
npm i -S @angular/compiler-cli
- &gt;其中添加了"devDependencies":{..., "@angular/compiler-cli": "^1.1.2",...}
然后安装了npm。更新2
在npm install
上,我在执行过程中看到了一些警告。关于警告的全部意义吗?
npm WARN @angular/compiler-cli@4.2.3 requires a peer of @angular/compiler@4.2.3 but none was installed.
npm WARN @angular/compiler-cli@4.2.3 requires a peer of @angular/core@4.2.3 but none was installed.
npm WARN @angular/core@2.2.3 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
npm WARN @angular/core@2.2.3 requires a peer of zone.js@^0.6.21 but none was installed.
npm WARN @angular/http@2.2.3 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
npm WARN @angular/router@3.2.3 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
npm WARN @ng-bootstrap/ng-bootstrap@1.0.0-alpha.26 requires a peer of @angular/core@^4.0.3 but none was installed.
npm WARN @ng-bootstrap/ng-bootstrap@1.0.0-alpha.26 requires a peer of @angular/common@^4.0.3 but none was installed.
npm WARN @ng-bootstrap/ng-bootstrap@1.0.0-alpha.26 requires a peer of @angular/forms@^4.0.3 but none was installed.
npm WARN angular2-ladda@1.2.1 requires a peer of @angular/core@^4.0.0 but none was installed.
npm WARN angular2-toaster@1.0.2 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
npm WARN codelyzer@1.0.0-beta.4 requires a peer of tslint@^3.9.0 but none was installed.
npm WARN ng2-bootstrap@1.6.3 requires a peer of @angular/common@^2.3.1 || >=4.0.0 but none was installed.
npm WARN ng2-bootstrap@1.6.3 requires a peer of @angular/compiler@^2.3.1 || >=4.0.0 but none was installed.
npm WARN ng2-bootstrap@1.6.3 requires a peer of @angular/core@^2.3.1 || >=4.0.0 but none was installed.
npm WARN ng2-bootstrap@1.6.3 requires a peer of @angular/forms@^2.3.1 || >=4.0.0 but none was installed.
npm WARN ng2-charts@1.6.0 requires a peer of @angular/common@^2.3.0 || >=4.0.0 but none was installed.
npm WARN ng2-charts@1.6.0 requires a peer of @angular/core@^2.3.0 || >=4.0.0 but none was installed.
npm WARN ng2-select@1.2.0 requires a peer of @angular/common@^2.3.0 but none was installed.
npm WARN ng2-select@1.2.0 requires a peer of @angular/core@^2.3.0 but none was installed.
仍然是同样的错误。还有其他建议吗?提前谢谢。
答案 0 :(得分:2)
您缺少编译器cli包,只需重新安装
npm i -S @angular/compiler-cli
你的package.json
似乎也缺少dev依赖关系中的角度cli,所以
npm i -D @angular/cli
答案 1 :(得分:1)
包没有数据:
npm i -g npm-check-updates
npm-check-updates -u
npm install
(How do I update each dependency in package.json to the latest version?) ......然后
npm install npm -g
(https://github.com/Urigo/angular-meteor/issues/1381)
感谢大家的帮助!
答案 2 :(得分:0)
在dependencies
数组
"@angular/cli": "1.0.0",
然后重新运行 npm install 和 ng serve 。
答案 3 :(得分:0)
我对Angular,node.js和npm相对较新,所以我不是说这是一个很好的解决方案,但是我遇到了一个非常类似的错误问题,我解决了以下问题(实验)
"dependencies": {
"@angular/animations": "^4.1.3",
"@angular/common": "^4.1.3",
"@angular/compiler": "^4.1.3",
"@angular/core": "^4.1.3",
"@angular/forms": "^4.1.3",
"@angular/http": "^4.1.3",
"@angular/platform-browser": "^4.1.3",
"@angular/platform-browser-dynamic": "^4.1.3",
"@angular/router": "^4.1.3",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"rxjs": "^5.4.1",
"webpack": "^2.6.1",
"zone.js": "^0.8.12"
}
"devDependencies": {
"@angular/cli": "1.1.1",
"@angular/compiler-cli": "^4.1.3",
"@types/jasmine": "2.5.51",
"@types/node": "~7.0.29",
"codelyzer": "~3.0.1",
"jasmine-core": "~2.6.3",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-node": "~3.0.6",
"tslint": "~5.4.3",
"typescript": "~2.3.4"
}
node_modules
。npm install
。npm outdated
,其中显示所有依赖项为MISSING
rxjs
(从5.4.0升级)@angular
dev依赖项
zone.js
,core-js
,webpack
和bootstrap
也匹配版本(看起来像顺序很重要)npm outdated
ng build
npm r @angular/compiler-cli -D
将其从dev依赖项中删除。不得不做两次,因为第一次失败,但似乎(失败的时间)在node_modules
npm i @angular/compiler-cli@4.1.3 -D
将其添加到我的开发依赖项ng build
答案 4 :(得分:0)
我遇到了相同的错误“ @ angular / compiler-cli”软件包是 没有正确安装。
这是我尝试过的几件事
1.Remove node_modules and run npm install
2.Installing latest version of typescript
3.Re-install cli npm install --save-dev @angular/cli@latest