create-react-native-app: Error: You are using npm version 5.0.3. Please use an npm version that is >= 3.0.0 and < 5.0.0.

I am not able to run the project using yarn start. I didn’t get any hint on this error.

Error: You are using npm version 5.0.3. Please use an npm version that is >= 3.0.0 and < 5.0.0.
9:08:07 PM: Error starting packager: Error: Couldn't start project. Please fix the errors and restart the project.
    at /xdl/src/Project.js:1038:11
    at next (native)
    at step (/home/medinesh/Documents/upwork/boilerplate/node_modules/xdl/build/Project.js:1468:191)
    at /home/medinesh/Documents/upwork/boilerplate/node_modules/xdl/build/Project.js:1468:361
    at process._tickCallback (internal/process/next_tick.js:109:7)
error Command failed with exit code 1.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 13
  • Comments: 25 (3 by maintainers)

Most upvoted comments

@Monte9 running npm install npm@4.6.1 in the project directory saved me

@Noor0 npm i -g npm@x.x.x where x.x.x is version number to

The project clearly states in README.md the following

You’ll need to have Node v6 or later on your machine. We strongly recommend using npm v3, v4, or a recent version of Yarn. Create React Native App does not currently work with npm v5 due to bugs in npm.

this is fixed in the latest version of react-native-scripts, you can update your project to it if you like, or create a new project and you will get it automatically

@muescha - not sure what you want us to do about that, our next release will remove the error message, but we absolutely needed it because too many people had issues with the project not working with npm 5. a workaround is sometimes necessary when there is buggy software in the ecosystem, like npm 5.0.0 -> npm 5.0.3. we had no way of knowing in advance what version of npm would resolve the problem so we just checked >= 5.0.0

Is there any way to downgrade npm except deleting and installing node again?

NPM v5.0.4 seems to bring the fix If this issues is related to https://github.com/npm/npm/issues/16893

Then, i’ve reproduced @brentvatne under 5.0.3 but it works under .4 package-lock looks good

Cause npm install <package name> will remove all other package for npm5 in yarn project like react native. So also recommend just using yarn add npm@4.6.1

But it will only change npm version in the project,if you want to active for all other project can using npm install npm@4.6.1 -g

It seems to work with newer versions of npm. I upgraded by doing npm install -g npm, which installed npm 5.3.0. After this, the warning went away.

@brentvatne I get this error using 1.5.0 of react-native-scripts. Is there a newer version?

It’s confusing because I’m trying to use yarn, not npm:

$ yarn ios
yarn ios v0.24.6
$ react-native-scripts ios 
11:23:33: Starting packager...
***ERROR STARTING PACKAGER***

Error: You are using npm version 5.0.3. We recommend version 4.6.1. To install it, run 'npm i -g npm@4.6.1'.
11:23:41: Starting simulator...

Ran into this as well. The error says I have v5.0.0 installed, but I when I check the version, I see the following. Not sure what’s going on here.

➜  test_proj npm -v
3.10.7