5

I'm beginning with react native today. I've never used it before. I tried to follow the most simple tutorial I've followed in my life: quick-start just until npm start

And there's no way I can run it. I've been trying for hours because it seems ridiculous, but the true is that I'm not getting it.

I use Ubuntu 16.04

npm -v: 4.6.1
node -v: v8.4.0

I've googled a lot, of course, but I didn't find anyone with my problem.

I'm getting these errors:

react-native-scripts start

01:06:19: 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! AwesomeProject@0.1.0 start: react-native-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the AwesomeProject@0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

and I got these warning while I tried: create-react-native-app AwesomeProject

npm WARN react-redux@5.0.6 requires a peer of react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0 but none was installed.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.1 (node_modules/jest-haste-map/node_modules/sane/node_modules/fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm WARN react-native-gesture-handler@1.0.0-alpha.17 requires a peer of react@>= 16.0.0 but none was installed.

npm WARN react-native-branch@2.0.0-beta.3 requires a peer of react@>=15.4.0 but none was installed.

npm WARN lottie-react-native@1.1.1 requires a peer of react@>=15.3.1 but none was installed.

I ran sudo npm i -g react and nothing, then sudo npm i -g react@15.6.1 and nothing.

I cannot install 16.0.0, because the "options" are: 0.0.1, 0.0.2, 0.0.3, 0.1.2, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.3.0, 0.3.4, 0.3.5, 0.5.0, 0.5.1, 0.5.2, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.7.0, 0.7.1, 0.8.0, 0.9.0-rc1, 0.9.0, 0.10.0-rc1, 0.10.0, 0.11.0-rc1, 0.11.0, 0.11.1, 0.11.2, 0.12.0-rc1, 0.12.0, 0.12.1, 0.12.2, 0.13.0-alpha.1, 0.13.0-alpha.2, 0.13.0-beta.1, 0.13.0-beta.2, 0.13.0-rc1, 0.13.0-rc2, 0.13.0, 0.13.1, 0.13.2, 0.13.3, 0.14.0-alpha1, 0.14.0-alpha2, 0.14.0-alpha3, 0.14.0-beta1, 0.14.0-beta2, 0.14.0-beta3, 0.14.0-rc1, 0.14.0, 0.14.1, 0.14.2, 0.14.3, 0.14.4, 0.14.5, 0.14.6, 0.15.0-alpha.1, 0.14.7, 15.0.0-rc.1, 15.0.0-rc.2, 0.14.8, 15.0.0, 15.0.1, 15.0.2-alpha.1, 15.0.2-alpha.2, 15.0.2-alpha.3, 15.0.2-alpha.4, 15.0.2, 15.0.3-alpha.1, 15.0.3-alpha.2, 15.1.0-alpha.1, 15.1.0, 15.2.0-rc.1, 15.2.0-rc.2, 15.2.0, 15.2.1, 15.3.0-rc.1, 15.3.0-rc.2, 15.3.0-rc.3, 15.3.0, 15.3.1-rc.1, 15.3.1-rc.2, 15.3.1, 15.3.2-rc.1, 15.3.2, 15.4.0-rc.1, 15.4.0-rc.2, 15.4.0-rc.3, 15.4.0-rc.4, 15.4.0, 15.4.1, 15.4.2, 16.0.0-alpha, 16.0.0-alpha.0, 16.0.0-alpha.2, 16.0.0-alpha.3, 16.0.0-alpha.4, 16.0.0-alpha.5, 16.0.0-alpha.6, 15.5.0-rc.1, 16.0.0-alpha.7, 15.5.0-rc.2, 16.0.0-alpha.8, 15.5.0, 15.5.1, 15.5.2, 15.5.3, 15.5.4, 16.0.0-alpha.9, 0.14.9, 16.0.0-alpha.10, 16.0.0-alpha.11, 16.0.0-alpha.12, 15.6.0-rc.1, 16.0.0-alpha.13, 15.6.0, 15.6.1, 16.0.0-beta.1, 16.0.0-beta.2, 16.0.0-beta.3, 16.0.0-beta.4, 16.0.0-beta.5

And https://git.io/v5vcn is as helpful as a github open ticket could be...

So, I don't know what can be wrong. Did anybody try to run that simple tutorial with ubuntu 16.04? Maybe someone got an answer.

Chuck Aguilar
  • 1,998
  • 1
  • 27
  • 50

3 Answers3

8

I solved it, it seems that I didn't have enough instances and watches. Just run these two commands, and it's gonna work.

sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=12288

and remember:

npm -v: 4.6.1
node -v: v8.4.0
Chuck Aguilar
  • 1,998
  • 1
  • 27
  • 50
  • 2
    Can you tell me why this problem occurs, as they have not mentioned the cause of this? – Abhishek Gangwar Feb 03 '18 at 07:30
  • When I add the first command, I get this returned: `sysctl: unknown oid 'fs.inotify.max_user_instances'`. I have `npm -v: 5.6.0` and `node -v: v8.11.3\ Are later versions of npm and node really incompatible with this command? – jimiayler Sep 02 '18 at 01:56
  • Fixed via an updated response in my terminal -- adding new answer below – jimiayler Sep 02 '18 at 16:27
1

I get entirely different commands in my error, probably the result of the updated versions of Node and npm I have installed (npm -v: 5.6.0 and node -v: v8.11.3):

  sudo sysctl -w kern.maxfiles=5242880
  sudo sysctl -w kern.maxfilesperproc=524288

These get the tutorial running for me in iOS via the Expo app.

jimiayler
  • 674
  • 2
  • 11
  • 27
0

At the beginning of the error message, you'll see two cli code snippets generated by the system. Copy paste and run each of them in that order. It worked for me. I'm using Terminal on OSX.

Ess
  • 1