最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to resolve npm dependency - Stack Overflow

programmeradmin0浏览0评论

[email protected] requires a peer of react@^15.0.0 but none is installed. You must install peer dependencies yourself.

I am very new to React. I installed the following open source project:

npm install --save react-tag-autoplete.

I was following the documentation stated here:

From the looks of it, I feel I have an older version of React. Am I correct? How can I fix it?

Here is the package.json

{
  "name": "reacttaggautoplete",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-scripts": "1.1.0",
    "react-tag-autoplete": "^5.5.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

[email protected] requires a peer of react@^15.0.0 but none is installed. You must install peer dependencies yourself.

I am very new to React. I installed the following open source project:

npm install --save react-tag-autoplete.

I was following the documentation stated here: https://www.npmjs./package/react-tag-autoplete

From the looks of it, I feel I have an older version of React. Am I correct? How can I fix it?

Here is the package.json

{
  "name": "reacttaggautoplete",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-scripts": "1.1.0",
    "react-tag-autoplete": "^5.5.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}
Share Improve this question edited Dec 2, 2018 at 15:05 Roy Scheffers 3,90811 gold badges33 silver badges36 bronze badges asked Feb 5, 2018 at 14:21 JavaDeveloperJavaDeveloper 5,68019 gold badges89 silver badges143 bronze badges 1
  • Does the project work with react@15 missing? It may be fine with react@16 and react-tag-autoplete's package.json just needs to bump their peer dependency version. – bcr Commented Feb 5, 2018 at 14:31
Add a ment  | 

2 Answers 2

Reset to default 1

Aparently you have installed React 16.2 so I'm guessing the problem is that react-tag-autoplete hasn't been updated to be used with the newer versions of react.

You could change the react dependency to "react": "^15.0.0" and then do a npm update and you should be fine (that will downgrade you to react 15).

Install the package to solve it

npm install react@^15.0.0
发布评论

评论列表(0)

  1. 暂无评论