使用Yarn创建React Native项目?
问题说明
我正在Windows 7(64位)计算机上的DOS控制台中运行以下命令.
I am running the following commands in the DOS console on a Windows 7 (64-bit) machine.
npm install -g yarn
yarn add global react-native
yarn add global react-native-cli
react-native init sample
运行react-native init sample
后,控制台已关闭.
After running react-native init sample
, the console was closed.
错误日志显示:
D:\Mobile>"$basedir/../../Users/pramaswamy/AppData/Local/Yarn/.global/node_modules/.bin/react-native.cmd" "$@"
D:\Mobile>exit $?
正确答案
我认为您在添加全局依赖项时出错,因此不需要在全局或本地安装react-native
. react-native init
将创建一个package.json
,其中react-native
被列为依赖项.
I think you're adding global dependencies wrong, and you shouldn't need to install react-native
, globally or locally. react-native init
will create a package.json
with react-native
listed as a dependency.
您应该能够通过yarn global add react-native-cli
而不是yarn add global react-native-cli
全局安装react-native-cli
.
You should be able to install react-native-cli
globally with yarn global add react-native-cli
, not yarn add global react-native-cli
.
运行以下命令应该没问题:
You should be fine with running the following:
npm install -g yarn
yarn global add react-native-cli
react-native init sample
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcckekj
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
检查邮件是否发送成功
it1352 07-25 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
Android微调工具-删除当前选择
it1352 06-20 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20 -
希伯来语的空格句子标记化错误
it1352 06-22