[英]react-icons/fa fails to install: Attempted import error: 'FaStar' is not exported from 'react-icons/fa'
I am trying to use react-icon FaStar in an app.我正在尝试在应用程序中使用 react-icon FaStar。 I first created a component in a separate create-react-app and used FaStar successfully in that install.
我首先在单独的 create-react-app 中创建了一个组件,并在该安装中成功使用了 FaStar。 Then I transported the.js and.cs files to the create-react-app that I am developing.
然后我将 .js 和 .cs 文件传输到我正在开发的 create-react-app。
After using npm install react-icon and I get使用 npm 安装 react-icon 后我得到
Attempted import error: 'FaStar' is not exported from 'react-icons/fa'.尝试导入错误:“FaStar”未从“react-icons/fa”导出。
When I look at node_modules/react-icon/fa/index.js all I see is当我查看 node_modules/react-icon/fa/index.js 时,我看到的是
/ THIS FILE IS AUTO GENERATED
var GenIcon = require('../lib').GenIcon
In the installation where I developed the component, I see在我开发组件的安装中,我看到
Any idea why this is happening?知道为什么会这样吗? Thanks
谢谢
The solution for this problem was rebuilding the project create-react-app by installing react-icons before all the other dependencies.这个问题的解决方案是通过在所有其他依赖项之前安装 react-icons 来重建项目 create-react-app。 One must have been interfering(probably http-proxy-middleware) with react-icons install.
一定是在干扰(可能是 http-proxy-middleware)安装 react-icons。
Here are the dependencies from package.json这是来自 package.json 的依赖项
"dependencies": {
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.22.0",
"http-proxy-middleware": "^2.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-hot-loader": "^4.13.0",
"react-icons": "^4.3.1",
"react-scripts": "4.0.3",
"web-vitals": "^1.1.2"
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.