npm开始不起作用create-react-native-app

时间:2018-02-20 08:35:34

标签: react-native ubuntu-16.04 create-react-native-app

npm版本是4.6.1 另请参阅github link

我创建了一个普通的hello world应用程序并尝试了

create-react-native-app HelloWorldVatsal

它创建了应用程序并加载了所有模块等,并在终端上发出了成功消息

之后如下所示

cd HelloWorldVatsal
npm start
HelloWorldVatsal@0.1.0 start /home/mvix-vatsal/HelloWorldVatsal
react-native-scripts start

14:52:58: Unable to start server
  See https://git.io/v5vcn for more information, either install watchman or run the following snippet:
    sudo sysctl -w fs.inotify.max_user_instances=1024
    sudo sysctl -w fs.inotify.max_user_watches=12288
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! HelloWorldVatsal@0.1.0 start: `react-native-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the HelloWorldVatsal@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mvix-vatsal/.npm/_logs/2018-02-19T09_22_58_504Z-debug.log

3 个答案:

答案 0 :(得分:3)

正如您从下面显示的错误消息行中看到的那样;

See https://git.io/v5vcn for more information, either install watchman or run the following snippet:
    sudo sysctl -w fs.inotify.max_user_instances=1024
    sudo sysctl -w fs.inotify.max_user_watches=12288

您需要安装watchman或运行错误消息中显示的代码段。

答案 1 :(得分:1)

安装watchman只为我工作:D

我的系统(mac) - > OSX 10.12.3

brew update

brew install watchman

答案 2 :(得分:0)

在Mac上运行以下命令对我有用:

sudo sysctl -w kern.maxfiles = 5242880

sudo sysctl -w kern.maxfilesperproc = 524288