[英]How to resolve “Critical dependency: the request of a dependency is an expression” error for my npm package?
[英]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.
我對 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"
}
}
顯然您已經安裝了 React 16.2,所以我猜問題是 react-tag-autocomplete 尚未更新以與較新版本的 react 一起使用。
您可以將 react 依賴項更改為"react": "^15.0.0"
,然后執行npm update
,您應該沒問題(這會將您降級為react 15 )。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.