我试图找到一个名为react-gauge-chart的包引起的包装问题。安装后,显示错误“找不到模块”。我想知道这个问题背后的原因。
这个问题发生在我的本地以及codesandbox example。
这是我当地的错误:
Failed to compile.
./src/views/home/CorrectiveMaintainanceReport.jsx
Module not found: Can't resolve 'react-gauge-chart' in '/Users/kongwenyao/Documents/GitLab/wefix/src/views/home'
以下是Codesandbox的错误:
Error
Could not fetch dependencies, please try again in a couple seconds: Something went wrong while packaging the dependency [email protected]: ENOENT: no such file or directory, scandir '/tmp/3739059402/node_modules/react-gauge-chart/dist'
我在package.json中的本地依赖项
"dependencies": {
"axios": "^0.18.0",
"chart.js": "2.7.3",
"classnames": "2.2.6",
"eslint-config-google": "^0.12.0",
"moment": "2.24.0",
"node-sass": "4.11.0",
"nouislider": "13.1.1",
"react": "16.8.4",
"react-chartjs-2": "2.7.4",
"react-copy-to-clipboard": "5.0.1",
"react-datetime": "2.16.3",
"react-dom": "16.8.4",
"react-gauge-chart": "^0.1.2",
"react-google-maps": "9.4.5",
"react-router-dom": "4.3.1",
"react-scripts": "2.1.8",
"reactstrap": "7.1.0"
},
它是因为您的包模块没有所需的包
安装
yarn add react-gauge-chart or npm install react-gauge-chart
还要确保它在package.json中的依赖项下列出