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

前端 未结 10 868
不知归路
不知归路 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:19

    "A requires a peer of B but none was installed". Consider it as "A requires one of B's peers but that peer was not installed and we're not telling you which of B's peers you need."

    The automatic installation of peer dependencies was explicitly removed with npm 3.

    NPM Blog

    Release notes of v3

    So you cannot install peer dependencies automatically with npm 3 and upwards.

    Updated Solution:

    Use following for each peer dependency to install that and remove the error

    npm install --save-dev xxxxx
    

    Deprecated Solution:

    1. You can use npm-install-peers to find and install required peer dependencies.

      npm install -g npm-install-peers

      npm-install-peers

    2. If you are getting this error after updating any package's version then remove node_modules directory and reinstall packages by npm install or npm cache clean and npm install.

提交回复
热议问题