React-native: npm start doesn't work after upgrade to 0.15.0

Created on 25 Nov 2015  ·  17Comments  ·  Source: facebook/react-native

npm start stopped working after upgrading to React-Native 0.15.0 yielding:

> [email protected] start Dev/tmp/AwesomeProject
> react-native start

Looks like you installed react-native globally, maybe you meant react-native-cli?
To fix the issue, run:
npm uninstall -g react-native
npm install -g react-native-cli

Output of npm -g list --depth=0:

/usr/local/lib
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Output of npm list --depth=0:

[email protected] Dev/tmp/AwesomeProject
└── [email protected]

To be noted, using react-native start works as expected, which make me think this is a npm bug but I'm not sure on how to get started.

Locked

Most helpful comment

Try adding react-native-cli to your (dev) dependencies.

All 17 comments

Hey Bhullnatik, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If this is a feature request or a bug that you would like to be fixed by the team, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • If you don't know how to do something or not sure whether some behavior is expected or a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • We welcome clear issues and PRs that are ready for in-depth discussion; thank you for your contributions!

Try adding react-native-cli to your (dev) dependencies.

It works perfectly ! Thanks @radko93

Thanks, this works but is it the expected behavior? Shouldn't react-native-cli be installed globally? Why the change in the 0.15.0?

npm 3 might have broken global lookup of modules from npm run-scripts (I haven't verified... just a guess)

@ide That's what my first thought was, but under the same node/npm configuration it works with React-Native 0.14.0, while it doesn't with the 0.15.0+.
I would be interested in fixing this myself, but I don't know where to begin looking.

Thanks for your answer.

It's not npm 3 case, I've tested it on npm v2 and archieved the same problem.

Ran into the issue, resolved after plenty of head scratching by cleaning node_modules (rm -rf ./node_modules) and then upgrading NPM (npm install npm -g) and install deps in the generated React Native project (npm install). Upgrade clash I guess, didn't have this issue last week.

http://stackoverflow.com/questions/33908314/packager-wont-start, the following helps me

  "scripts": {
    "start": "$NVM_BIN/react-native start"
  }

:+1: adding cli as a dependency worked for me for android deploys

Something went fishy with today's build. I had to:
npm un react-native-cli and npm i react-native-cli
FYI for others.

@GantMan same thing happened to me too. Reinstalling react-native-cli once you update react-native solves the problem as you mentioned.

Adding react-native-cli to dev-deps doesn't solve the issue. What is the real issue here?

"react-native": "0.19.0",
"react-native-cli": "~0.2.0"
$ node -v 
v6.1.0
$ npm -v 
3.8.6

After npm install,

$ ls -l node_modules/.bin/react-native
lrwxr-xr-x  1 madhu  staff  47 May 17 15:04 node_modules/.bin/react-native -> ../react-native/local-cli/wrong-react-native.js

Ah, nevermind

npm un react-native-cli -D
npm un react-native-cli -g
rm -rf node_modules
npm cache clear
npm i
npm i react-native-cli -D

and then it works. Weird !!

Was this page helpful?
0 / 5 - 0 ratings