react-native - 无法使用本机代码创建项目
问题描述
我一直在四处寻找并已经重新安装了 node、react-native-cli 和 watchman。我正在使用模拟器,设置是:
macOS High Sierra 10.13.6
react-native: 0.57.1
node v10.11.0
watchman 4.9.0
每次我使用以下方法创建项目时:
react-native init [project_name]
我得到这个红屏:
我已经尝试过这个:
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.
4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.
at ModuleResolver.resolveDependency (/Users/ivofreitas/Projects/JavascriptWorkspace/react-native/YourProject/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:209:1301)
尝试使用早期版本的 react 创建,例如:
react-native init [YourProject] --version react-native@0.55.4
我再次做了这个https://facebook.github.io/react-native/docs/getting-started教程并重新安装所有内容但没有成功
解决方案
我在 github 上找到了这篇文章
https://github.com/facebook/react-native/issues/21310
它通过以下方式解决问题:
npm add @babel/runtime
npm install
正如链接中所说,它不应该那样工作。
推荐阅读
- sql - 使用 Case 的 SQL Window 函数
- stored-procedures - 没有参数的redshift过程和参数中的动态表名
- node.js - 在 res.writeHead 之后 Express res.render 不工作
- php - 如何使用 jquery 更改 DIV 中数据顶部和数据范围的值
- azure-ad-b2c - 在 Azure AD B2C 中更新后,如何刷新 id 令牌中的用户属性?
- sql - quote_ident() 不会在列名“first”中添加引号
- javascript - 在 ReactJS iFrame 问题中第二次在剪贴板中获取复制的文本
- node.js - Puppeteer:无法打开并使用 Windows 文件对话框上传文件
- node.js - Node/WebpackDevServer/react-scripts,在启动时删除“To create a production build, use npm run build”消息
- facebook - Facebook 应用程序画布 setSize 和 setAutoGrow 在登录时不再工作