简体   繁体   中英

Angular 4 - trying to upgrade project - “requires a peer of” errors

I try to install the latest angular version in my project but I get tons of "requires a peer of/You must install peer dependencies yourself." errors, I have no idea how to solve this

I guess it's probably not a bug so asking on angular git hub will probably get rejected

I tried

npm install @angular/core@latest -S

also tried

npm install @angular/common@latest -S

still got the same,

why is NPM not dealing with this ?

npm WARN rollback Rolling back node-pre-gyp@0.6.39 failed (this is probably harmless): EPERM: operation not permitted, rmdir '\node_modules\fsevents\node_modules'
npm WARN @angular/common@5.2.10 requires a peer of rxjs@^5.5.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/compiler@4.0.0 requires a peer of @angular/core@4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/core@5.2.10 requires a peer of rxjs@^5.5.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/forms@4.0.0 requires a peer of @angular/core@4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/forms@4.0.0 requires a peer of @angular/common@4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/http@4.0.0 requires a peer of @angular/core@4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser@4.0.0 requires a peer of @angular/core@4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser@4.0.0 requires a peer of @angular/common@4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser-dynamic@4.0.0 requires a peer of @angular/core@4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser-dynamic@4.0.0 requires a peer of @angular/common@4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/router@4.0.0 requires a peer of @angular/core@4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/router@4.0.0 requires a peer of @angular/common@4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-progress-http@0.5.1 requires a peer of @angular/core@^2.3.1 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular2-cookie@1.2.6 requires a peer of @angular/common@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular2-cookie@1.2.6 requires a peer of @angular/core@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer@2.0.0 requires a peer of @angular/core@^2.3.1 || >=4.0.0-beta <5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng2-accordion@0.0.15 requires a peer of @angular/core@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng2-dnd@4.2.0 requires a peer of @angular/core@^2.4.4 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng2-toasty@4.0.3 requires a peer of @angular/core@^2.4.7 || ^4.0.0 but none is installed. You must install peer dependencies yourself.

thanks

edit : package.json ( ^ dont get updated to the latest version, I try to do it manualy)

"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",
    "@ngui/tab": "^0.5.0",
    "angular-progress-http": "^0.5.1",
    "angular2-cookie": "1.2.6",
    "angular2-prettyjson": "^2.0.5",
    "chart.js": "^2.6.0",
    "core-js": "2.4.1",
    "es5-shim": "^4.5.9",
    "es6-shim": "^0.35.3",
    "mydaterangepicker": "^4.1.9",
    "ng2-accordion": "0.0.15",
    "ng2-charts": "^1.6.0",
    "ng2-dnd": "^4.2.0",
    "ng2-toasty": "^4.0.3",
    "ng2-validation": "4.1.0",
    "reflect-metadata": "0.1.3",
    "rxjs": "^5.0.1",
    "tinymce": "^4.6.2",
    "ts-md5": "^1.2.0",
    "zone.js": "0.8.5"
  },
  "devDependencies": {
    "@angularclass/hmr": "^1.0.1",
    "@angularclass/hmr-loader": "^3.0.2",
    "@types/jasmine": "^2.5.47",
    "@types/node": "^6.0.72",
    "@types/selenium-webdriver": "2.53.39",
    "angular-router-loader": "^0.6.0",
    "angular2-template-loader": "^0.6.0",
    "autoprefixer": "^6.3.2",
    "awesome-typescript-loader": "^3.1.3",
    "codelyzer": "2.0.0",
    "copy-webpack-plugin": "^4.0.1",
    "css-loader": "^0.26.1",
    "extract-text-webpack-plugin": "^2.1.0",
    "file-loader": "^0.10.0",
    "html-loader": "^0.4.0",
    "html-webpack-plugin": "^2.28.0",
    "istanbul-instrumenter-loader": "^0.2.0",
    "jasmine-core": "^2.6.1",
    "jasmine-spec-reporter": "^3.2.0",
    "json-loader": "^0.5.4",
    "karma": "1.4.1",
    "karma-chrome-launcher": "^2.1.0",
    "karma-coverage": "^1.0.0",
    "karma-jasmine": "^1.1.0",
    "karma-mocha-reporter": "^2.2.3",
    "karma-remap-istanbul": "0.2.1",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-webpack": "2.0.2",
    "node-sass": "^4.5.2",
    "null-loader": "0.1.1",
    "on-build-webpack": "^0.1.0",
    "postcss-loader": "^1.1.0",
    "protractor": "^4.0.10",
    "raw-loader": "0.5.1",
    "remap-istanbul": "^0.6.4",
    "rimraf": "^2.6.1",
    "sass-loader": "^6.0.3",
    "shelljs": "^0.7.0",
    "style-loader": "^0.13.0",
    "ts-helpers": "^1.1.1",
    "tslint": "^4.3.1",
    "tslint-loader": "^3.5.3",
    "typedoc": "^0.5.1",
    "typescript": "^2.3.2",
    "url-loader": "^0.5.8",
    "webpack": "2.2.1",
    "webpack-dev-server": "2.3.0",
    "webpack-plugin-hash-output": "^1.3.0"
  }

You could 2 things:

  1. Do npm install abc ... where a, b and c are the peer dependecies you need to update.
  2. You could install a package that take care of peer dependecies such as this one: https://www.npmjs.com/package/npm-install-peers

If these 2 don't work try uninstall angular/cli, delete package.json and package-lock.json files, install angular/cli's version you want and then npm install

Install the latest Angular CLI globally on your computer. Then go to the root dir of your Angular 4 project and run the ng update command. It'll properly update the dependencies in your package.json to the latest Angular version.

经过几天的摆弄,我用CLI重新创建了我的项目,这是解决此问题的唯一下降方式。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM