我正在使用Angular2 / Angular4构建应用程序,当我运行命令“npm install”时,我遇到了这些错误。
+-- UNMET PEER DEPENDENCY @angular/common@4.2.3
+-- UNMET PEER DEPENDENCY @angular/compiler@4.2.3
+-- UNMET PEER DEPENDENCY @angular/core@4.2.3
+-- UNMET PEER DEPENDENCY @angular/forms@4.2.3
事实是,我在node_modules/...
中获得了这些模块,我的应用程序运行正常,但是当我尝试使用Docker时,我的问题就出现了:
npm ERR! peerinvalid The package @angular/common@4.2.3 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/forms@4.2.3 wants @angular/common@4.2.3
npm ERR! peerinvalid Peer @angular/platform-browser@4.2.3 wants @angular/common@4.2.3
npm ERR! peerinvalid Peer @angular/platform-browser-dynamic@4.2.3 wants @angular/common@4.2.3
npm ERR! peerinvalid Peer @angular/router@4.2.3 wants @angular/common@4.2.3
正如您所看到的,我几乎在“npm install”期间获得的模块上遇到了错误。那么,为什么命令行需要已安装的相同版本的模块并且看不到它们呢?
我试图删除“node_nodules”文件夹并启动清理项目,我在这里看到了类似的答案,但它们没有关系或没有帮助。
的package.json
我使用angular2-webpack-starter,当我开始收到这些错误时,我尝试将所有模块更新为Angular4但没有任何改变。
{
"name": "angular2-webpack-starter",
"version": "5.4.1",
"description": "An Angular 2 Webpack Starter kit featuring Angular 2 (Router, Http, Forms, Services, Tests, E2E, Coverage), Karma, Protractor, Jasmine, Istanbul, TypeScript, and Webpack by AngularClass",
"keywords": [
"angular2",
"webpack",
"typescript"
],
"author": "Patrick Stapleton <patrick@angularclass.com>",
"homepage": "https://github.com/angularclass/angular2-webpack-starter",
"license": "MIT",
"scripts": {
"build:aot:prod": "npm run clean:dist && npm run clean:aot && webpack --config config/webpack.prod.js --progress --profile --bail",
"build:aot": "npm run build:aot:prod",
"build:dev": "npm run clean:dist && webpack --config config/webpack.dev.js --progress --profile",
"build:docker": "npm run build:prod && docker build -t angular2-webpack-start:latest .",
"build:prod": "npm run clean:dist && webpack --config config/webpack.prod.js --progress --profile --bail",
"build": "npm run build:dev",
"ci:aot": "npm run lint && npm run test && npm run build:aot && npm run e2e",
"ci:jit": "npm run lint && npm run test && npm run build:prod && npm run e2e",
"ci:nobuild": "npm run lint && npm test && npm run e2e",
"ci:testall": "npm run lint && npm run test && npm run build:prod && npm run e2e && npm run build:aot && npm run e2e",
"ci:travis": "npm run lint && npm run test && npm run build:aot && npm run e2e:travis",
"ci": "npm run ci:testall",
"clean:dll": "npm run rimraf -- dll",
"clean:aot": "npm run rimraf -- compiled",
"clean:dist": "npm run rimraf -- dist",
"clean:install": "npm set progress=false && npm install",
"clean": "npm cache clean && npm run rimraf -- node_modules doc coverage dist compiled dll",
"docker": "docker",
"docs": "npm run typedoc -- --options typedoc.json --exclude '**/*.spec.ts' ./src/",
"e2e:live": "npm-run-all -p -r server:prod:ci protractor:live",
"e2e:travis": "npm-run-all -p -r server:prod:ci protractor:delay",
"e2e": "npm-run-all -p -r server:prod:ci protractor",
"github-deploy:dev": "webpack --config config/webpack.github-deploy.js --progress --profile --env.githubDev",
"github-deploy:prod": "webpack --config config/webpack.github-deploy.js --progress --profile --env.githubProd",
"github-deploy": "npm run github-deploy:dev",
"lint": "npm run tslint \"src/**/*.ts\"",
"postinstall": "npm run webdriver:update",
"postversion": "git push && git push --tags",
"preclean:install": "npm run clean",
"preversion": "npm test",
"protractor": "protractor",
"protractor:delay": "sleep 3 && npm run protractor",
"protractor:live": "protractor --elementExplorer",
"rimraf": "rimraf",
"server:dev:hmr": "npm run server:dev -- --inline --hot",
"server:dev": "webpack-dev-server --config config/webpack.dev.js --open --progress --profile --watch --content-base src/",
"server:prod": "http-server dist -c-1 --cors",
"server:prod:ci": "http-server dist -p 3000 -c-1 --cors",
"server": "npm run server:dev",
"start:hmr": "npm run server:dev:hmr",
"start": "npm run server:dev",
"test": "npm run lint && karma start",
"tslint": "tslint",
"typedoc": "typedoc",
"version": "npm run build",
"watch:dev:hmr": "npm run watch:dev -- --hot",
"watch:dev": "npm run build:dev -- --watch",
"watch:prod": "npm run build:prod -- --watch",
"watch:test": "npm run test -- --auto-watch --no-single-run",
"watch": "npm run watch:dev",
"webdriver-manager": "webdriver-manager",
"webdriver:start": "npm run webdriver-manager start",
"webdriver:update": "webdriver-manager update",
"webpack-dev-server": "webpack-dev-server",
"webpack": "webpack"
},
"dependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"angular2-tag-input": "^1.2.3",
"http-server": "^0.9.0",
"ie-shim": "^0.1.0",
"jasmine-core": "^2.4.1",
"ng2-img-cropper": "^0.8.8",
"reflect-metadata": "^0.1.9",
"angular-in-memory-web-api": "^0.3.0",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@types/hammerjs": "^2.0.33",
"@types/jasmine": "^2.2.34",
"@types/node": "^7.0.0",
"@types/selenium-webdriver": "~2.53.39",
"@types/source-map": "^0.5.0",
"@types/uglify-js": "^2.0.27",
"@types/webpack": "^2.0.0",
"concurrently": "^3.2.0",
"lite-server": "^2.2.2",
"add-asset-html-webpack-plugin": "^1.0.2",
"angular2-template-loader": "^0.6.0",
"assets-webpack-plugin": "^3.5.1",
"awesome-typescript-loader": "~3.0.0-beta.18",
"codelyzer": "~2.0.0-beta.4",
"copy-webpack-plugin": "^4.0.0",
"css-loader": "^0.26.0",
"exports-loader": "^0.6.3",
"expose-loader": "^0.7.1",
"extract-text-webpack-plugin": "~2.0.0-rc.3",
"file-loader": "^0.10.0",
"find-root": "^1.0.0",
"gh-pages": "^0.12.0",
"html-webpack-plugin": "^2.28.0",
"imports-loader": "^0.7.0",
"istanbul-instrumenter-loader": "2.0.0",
"jasmine-core": "^2.5.2",
"json-loader": "^0.5.4",
"karma": "^1.4.1",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-coverage": "^1.1.1",
"karma-jasmine": "^1.0.2",
"karma-mocha-reporter": "^2.2.2",
"karma-remap-coverage": "^0.1.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "2.0.1",
"karma-jasmine-html-reporter": "^0.2.2",
"ng-router-loader": "^2.1.0",
"ngc-webpack": "1.1.0",
"node-sass": "^4.5.0",
"npm-run-all": "^4.0.1",
"optimize-js-plugin": "0.0.4",
"parse5": "^3.0.1",
"protractor": "^4.0.14",
"raw-loader": "0.5.1",
"rimraf": "~2.6.0",
"sass-loader": "^6.0.0",
"script-ext-html-webpack-plugin": "^1.6.2",
"source-map-loader": "^0.1.5",
"string-replace-loader": "1.0.5",
"style-loader": "^0.16.0",
"to-string-loader": "^1.1.4",
"ts-node": "^2.0.0",
"tslib": "^1.5.0",
"canonical-path": "0.0.2",
"tslint": "^3.15.1",
"lodash": "^4.16.4",
"tslint-loader": "^3.3.0",
"typedoc": "^0.5.3",
"typescript": "~2.2.1",
"url-loader": "^0.5.7",
"webpack": "2.3.1",
"webpack-dev-middleware": "^1.10.0",
"webpack-dev-server": "2.4.1",
"webpack-dll-bundles-plugin": "^1.0.0-beta.5",
"webpack-merge": "~3.0.0"
},
"repository": {}
}
答案 0 :(得分:0)
找到解决方案 - 角度包的版本有诀窍。更新到最后一个版本后一切都很好。