简体   繁体   English

如何解决 npm 依赖

[英]How to resolve npm dependency

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

I am very new to React.我对 React 很陌生。 I installed the following open source project:我安装了以下开源项目:

npm install --save react-tag-autocomplete.

I was following the documentation stated here: https://www.npmjs.com/package/react-tag-autocomplete我正在关注此处所述的文档: https ://www.npmjs.com/package/react-tag-autocomplete

From the looks of it, I feel I have an older version of React.从外观上看,我觉得我有一个旧版本的 React。 Am I correct?我对么? How can I fix it?我该如何解决?

Here is the package.json这是 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"
  }
}

Aparently you have installed React 16.2 so I'm guessing the problem is that react-tag-autocomplete hasn't been updated to be used with the newer versions of react.显然您已经安装了 React 16.2,所以我猜问题是 react-tag-autocomplete 尚未更新以与较新版本的 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 ).您可以将 react 依赖项更改为"react": "^15.0.0" ,然后执行npm update ,您应该没问题(这会将您降级react 15 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM