如何解决npm依赖

时间:2018-02-05 14:21:09

标签: javascript node.js reactjs

react-tag-autocomplete@5.5.0 requires a peer of react@^15.0.0 but none is installed. You must install peer dependencies yourself.

我对React很新。我安装了以下开源项目:

npm install --save react-tag-autocomplete.

我按照此处说明的文件: https://www.npmjs.com/package/react-tag-autocomplete

从它的外观来看,我觉得我有一个旧版本的React。我对么? 我该如何解决?

这是package.json

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

1 个答案:

答案 0 :(得分:0)

显然你已经安装了React 16.2所以我猜测问题是react-tag-autocomplete还没有被更新以用于更新版本的react。

您可以将响应依赖关系更改为"react": "^15.0.0",然后执行npm update并且您应该没问题(降级反应15 )。