无法启动ReactNativeProject

问题描述 投票:12回答:4

我按照https://facebook.github.io/react-native/docs/getting-started.html#content链接中的教程进行操作。事实证明,目前还不支持npm 5。我尝试安装npm 4,但它也没有工作。陷入本教程的第一页,当我运行npm start时,我也遇到了一堆错误。直截了当,无处可去。在对问题进行投票之前,请注意我是一名移动开发人员,与ororid和Ios合作,之前并不了解Web技术。谢谢

这些是我遵循的步骤

npm install -g create-react-native-app

那是成功的,

create-react-native-app AwesomeProject

对于这一行,我得到以下错误

    *******************************************************************************
ERROR: npm 5 is not supported yet
*******************************************************************************

It looks like you're using npm 5 which was recently released.

Create React Native App doesn't work with npm 5 yet, unfortunately. We
recommend using npm 4 or yarn until some bugs are resolved.

You can follow the known issues with npm 5 at:
https://github.com/npm/npm/issues/16991

*******************************************************************************

然后我运行了命令

cd AwesomeProject

然后我跑了

npm start

我得到了错误

    npm ERR! missing script: start

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jayakrishnan/.npm/_logs/2017-07-25T08_13_06_277Z-debug.log

我尝试使用Yarn但没有工作

react-native npm-install
4个回答
34
投票

npm i -g [email protected] - 然后再次安装create-react-native-app并创建一个项目。


2
投票

纱线解决方案:

首先安装纱线

yarn global add create-react-native-app
cd AwesomeProject
yarn start

1
投票

npm install -g npm @ 4使用它来降级,也可以在命令中使用sudo,有时它会提供写入错误的权限并跳过安装


0
投票

尝试提供有关错误的更多信息,以便我们提供帮助,或者尝试重现错误。

要尝试的一件事是使用npm而不是使用yarn。如果你在mac上安装yarn brew install yarn并在getting-started指南中执行相同的步骤,除了使用yarn run ios在ios模拟器中启动应用程序。我只是尝试了一个新的设置,这是完美的。

参考yarn https://yarnpkg.com/en/

© www.soinside.com 2019 - 2024. All rights reserved.