我使用create-react-native-app
创建一个新项目,然后键入npm run eject
使该应用程序成为纯本机应用程序。
然后我的步骤是:
1。npm install --save react-native-elements
2。react-native link react-native-vector-icons
但是当我只添加此代码时
import { Button } from 'react-native-elements';
在我的App.js
我检查终端是否显示错误:
error: bundling failed: Error: While trying to resolve module `react-native-elements` from file `/Users/huaweb/ReactNativeProject/Huaweb2/App.js`, the package `/Users/huaweb/ReactNativeProject/Huaweb2/node_modules/react-native-elements/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/huaweb/ReactNativeProject/Huaweb2/node_modules/react-native-elements/src/index.js`. Indeed, none of these files exist:
为什么我不能导入我的图书馆?我不知道。
任何帮助将不胜感激。预先感谢。