npm WARN … requires a peer of … but none is installed. You must install peer dependencies yourself

前端 未结 10 848
不知归路
不知归路 2020-11-29 15:44

I tried to run a project downloaded from github. Unfortunately, during npm install the following warnings were shown. I tried to change the version based on thi

相关标签:
10条回答
  • 2020-11-29 16:30

    You need to only depend on one major version of angular, so update all modules depending on angular 2.x :

    • update @angular/flex-layout to ^2.0.0-beta.9
    • update @angular/material to ^2.0.0-beta.12
    • update angularfire2 to ^4.0.0-rc.2
    • update zone.js to ^0.8.18
    • update webpack to ^3.8.1
    • add @angular/cdk@2.0.0-beta.12 (required for @angular/material)
    • replace angular2-google-maps by @agm/core@1.0.0-beta.1 (new name)
    0 讨论(0)
  • 2020-11-29 16:32

    The accepted answer of using npm-install-peers did not work, nor removing node_modules and rebuilding. The answer to run

    npm install --save-dev @xxxxx/xxxxx@latest
    

    for each one, with the xxxxx referring to the exact text in the peer warning, worked. I only had four warnings, if I had a dozen or more as in the question, it might be a good idea to script the commands.

    0 讨论(0)
  • 2020-11-29 16:34

    I had a similar issue and solved after running these instructions!

    npm install npm -g
    npm install --save-dev @angular/cli@latest
    npm install
    npm start
    
    0 讨论(0)
  • 2020-11-29 16:35

    npm i -D @angular/material @angular/cdk @angular/animations

    0 讨论(0)
提交回复
热议问题