尝试使用 Expo 构建 create-react-app 项目,抛出与 react-native 相关的错误。

huangapple go评论94阅读模式
英文:

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

https://github.com/expo/expo-cli/issues/248

huangapple
  • 本文由 发表于 2020年1月6日 23:57:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/59615182.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定