• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

使用Yarn创建React Native项目?

用户头像
it1352
帮助1

问题说明

我正在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 $? 

正确答案

#1

我认为您在添加全局依赖项时出错,因此不需要在全局或本地安装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
系列文章
更多 icon
同类精品
更多 icon
继续加载