我们有一个Angular解决方案可以在一台机器上完美运行,但在另一台机器上运行以下命令会引发错误......
npm install
出现的错误是......
npm WARN angular4-social-login@1.1.1 requires a peer of @angular/core@^4.0.0 but none was installed.
npm WARN angular2-jwt@0.1.28 requires a peer of @angular/core@^2.0.0 but none was installed.
npm WARN angular2-jwt@0.1.28 requires a peer of @angular/http@^2.0.0 but none was installed.
npm WARN angular2-moment@0.8.2 requires a peer of @angular/core@^2.0.0-rc.0 but none was installed.
npm WARN ng2-page-scroll@3.2.3 requires a peer of @angular/core@~2.1.2 but none was installed.
npm WARN ng2-page-scroll@3.2.3 requires a peer of @angular/common@~2.1.2 but none was installed.
npm WARN ng2-page-scroll@3.2.3 requires a peer of @angular/compiler@~2.1.2 but none was installed.
npm WARN ng2-page-scroll@3.2.3 requires a peer of @angular/platform-browser@~2.1.2 but none was installed.
npm WARN ng2-page-scroll@3.2.3 requires a peer of @angular/router@~3.1.2 but none was installed.
npm WARN ng2-page-scroll@3.2.3 requires a peer of rxjs@~5.0.0-beta.12 but none was installed.
npm WARN ng2-page-scroll@3.2.3 requires a peer of zone.js@~0.6.23 but none was installed.
npm WARN ng2-img-cropper@0.9.0 requires a peer of @angular/common@^4.0.0 but none was installed.
npm WARN ng2-img-cropper@0.9.0 requires a peer of @angular/compiler@^4.0.0 but none was installed.
npm WARN ng2-img-cropper@0.9.0 requires a peer of @angular/core@^4.0.0 but none was installed.
npm WARN ng4-geoautocomplete@0.1.0 requires a peer of @angular/core@>=2.0.0 <5.0.0 but none was installed.
npm WARN ng2-social-share@0.0.10 requires a peer of @angular/common@^2.0.0-rc.3 but none was installed.
npm WARN ng2-social-share@0.0.10 requires a peer of @angular/compiler@^2.0.0-rc.3 but none was installed.
npm WARN ng2-social-share@0.0.10 requires a peer of @angular/core@^2.0.0-rc.3 but none was installed.
npm WARN ng2-social-share@0.0.10 requires a peer of @angular/http@^2.0.0-rc.3 but none was installed.
npm WARN codelyzer@2.1.1 requires a peer of @angular/compiler@^2.3.1 || >=4.0.0-beta <5.0.0 but none was installed.
npm WARN codelyzer@2.1.1 requires a peer of @angular/core@^2.3.1 || >=4.0.0-beta <5.0.0 but none was installed.
npm WARN @angular/compiler-cli@5.0.5 requires a peer of typescript@>=2.4.2 <2.5 but none was installed.
npm WARN @angular/compiler-cli@5.0.5 requires a peer of @angular/compiler@5.0.5 but none was installed.
npm WARN tsickle@0.24.1 requires a peer of typescript@2.4.2 but none was installed.
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none was installed.
packages.json依赖项部分看起来像这样......
"dependencies": {
"@agm/core": "^1.0.0-beta.2",
"@angular/animations": "~5.1.0",
"@angular/common": "~5.1.0",
"@angular/compiler": "~5.1.0",
"@angular/core": "~5.1.0",
"@angular/forms": "~5.1.0",
"@angular/http": "~5.1.0",
"@angular/platform-browser": "~5.1.0",
"@angular/platform-browser-dynamic": "~5.1.0",
"@angular/platform-server": "~5.1.0",
"@angular/router": "~5.1.0",
"angular-svg-icon": "^5.0.0",
"angular2-infinite-scroll": "^0.2.9",
"angular2-jwt": "^0.1.28",
"angular2-moment": "^0.8.2",
"angular4-social-login": "^1.1.1",
"angulartics2": "^1.6.3",
"core-js": "^2.5.1",
"googlemaps": "^1.12.0",
"http-server": "^0.10.0",
"ie-shim": "^0.1.0",
"ng-inline-svg": "^6.1.0",
"ng2-bootstrap": "^1.2.6",
"ng2-file-upload": "^1.3.0",
"ng2-img-cropper": "^0.9.0",
"ng2-page-scroll": "^3.2.3",
"ng2-social-share": "^0.0.10",
"ng4-geoautocomplete": "^0.1.0",
"reflect-metadata": "^0.1.12",
"rxjs": "^5.5.2",
"zone.js": "^0.8.20"
},
我们无法理解为什么这种情况发生在一台机器上而不是另一台机器上。一台机器必须安装不同的东西吗?
该项目是从这个初学者包构建的 https://github.com/bencameron00/angular-starter
有没有人有任何想法?
答案 0 :(得分:0)
如上面的评论中所述,解决方案是删除波浪线...
“如果您使用低于^ 5.x.x的npm版本(意味着您没有package-lock.json,则可以尝试从package.json中删除所有〜和^”。