尝试安装依赖项时出现多个NPM错误

时间:2018-01-13 22:14:27

标签: reactjs npm

我正在使用React,Windows 10,NPM - 2.15.12,Node v6.11.3。 在尝试使用Create-React-App安装依赖项时,我收到以下错误:

        C:\xampp\htdocs\react-new-repo>npm i
        npm ERR! Windows_NT 10.0.15063
        npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\roy\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i"
        npm ERR! node v6.11.3
        npm ERR! npm  v2.15.12
        npm ERR! code EPEERINVALID

        npm ERR! peerinvalid The package react@16.2.0 does not satisfy its siblings' peerDependencies requirements!
        npm ERR! peerinvalid Peer react-dom@16.2.0 wants react@^16.0.0
        npm ERR! peerinvalid Peer react-router-dom@4.0.0 wants react@^15
        npm ERR! peerinvalid Peer react-intl-tel-input@4.3.0 wants react@^15.4.2

        npm ERR! Please include the following file with any support request:
        npm ERR!     C:\xampp\htdocs\react-new-repo\npm-debug.log

1 个答案:

答案 0 :(得分:1)

您似乎无法对项目使用react v16,因为它具有需要v15的依赖项。

您可以在package.json中指定v15作为反应,例如

"dependencies": {
   "react": "15.6.2"
   ...

或者,您可以尝试将依赖项(即react-router-domreact-intl-tel-input)升级到与react v16一起使用的版本