英文:
Trying to build a create-react-app project with expo, throws error about react-native
问题
I've created my react app using create-react-app, and was trying to use expo, but its throwing errors when I try and build it using expo build:android
:
错误:在 package.json 依赖项中找不到 react-native
错误:未安装 React Native。请在项目目录中运行 `npm install`。
我需要重新开始一个 react-native 项目,还是有办法继续并发布这个项目?
英文:
I've created my react app using create-react-app, and was trying to use expo, but its throwing errors when I try and build it using expo build:android
:
Error: Can't find react-native in package.json dependencies
Error: React Native is not installed. Please run `npm install` in your project directory.
Do I need to start over with a react-native project, or is there a way to continue on and get this project published?
答案1
得分: 1
我建议您使用expo文档创建您的项目:
npm install expo-cli --global
expo init my-new-project
cd my-new-project
expo start
英文:
I suggest you create your project using the expo docs :
npm install expo-cli --global
expo init my-new-project
cd my-new-project
expo start
答案2
得分: 0
尝试这样做:
- 删除 node_modules 文件夹。
- 运行 "yarn install"。
- 运行 "expo start"。
这似乎类似于此 GitHub 错误:
https://github.com/expo/expo-cli/issues/248
英文:
Try this:
- Remove node_modules folder.
- run "yarn install".
- run "expo start".
This looks like a similar issue on this github error
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论