我试过安装react图标,在我的应用程序中我运行了 npm 命令:
sudo npm install react-icons --save
除了一些可选的依赖项之外,我没有收到任何错误
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4
(node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current:
{"os":"linux","arch":"x64"})
每当我尝试导入某些图标时,都会出现错误
./src/components/SkiDaysCount.js
Module not found: Can't resolve 'react-icons/lib/md' in '
'/home/kristoffer/ReactApps/navbar/src/components'
这是我的进口:
import {Terrain} from 'react-icons/lib/md'
import {SnowFlake} from 'react-icons/lib/ti'
import {Calender} from 'react-icons/lib/fa'
为什么我收到这个错误?
编辑:
我还尝试使用旧语法进行导入,但存在同样的问题:
import Calender from 'react-icons/lib/fa/calender'