Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot start npm in the react native tutorial

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! [email protected] start: react-native-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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 [email protected] 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 [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm WARN [email protected] requires a peer of react@>= 16.0.0 but none was installed.

npm WARN [email protected] requires a peer of react@>=15.4.0 but none was installed.

npm WARN [email protected] 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 [email protected] 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.

like image 748
Chuck Aguilar Avatar asked Aug 21 '17 23:08

Chuck Aguilar


People also ask

Why is npm start giving error?

Missing script: "start" error occurs for multiple reasons: Missing a start script in the scripts section of your package. json file. Opening your IDE or shell in a directory that doesn't contain your package.

What is npm start in react-native?

npm start: is to start the metro bundler that is required to run any react-native application.

Why npm install is not working?

The Npm command not found error can appear when you install or upgrade npm. On Windows, the cause of this error could be that a PATH or system variable is not correctly set. The error can also occur if you do not have npm or Node. js installed, have an outdated version, or have permission issues.


2 Answers

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
like image 53
Chuck Aguilar Avatar answered Oct 12 '22 09:10

Chuck Aguilar


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.

like image 1
jimiayler Avatar answered Oct 12 '22 08:10

jimiayler