React Native run config - invalid package location

I've set up a Run config for React native, as per blog post

  • Node interpreter is set to /usr/local/Cellar/node/7.9.0/bin/node
  • React Native package set to /usr/local/Cellar/node/7.9.0/bin
  • Target platform - iOS

When I click Run I get:

/usr/local/Cellar/node/7.9.0/bin/node /usr/local/Cellar/node/7.9.0/bin start
module.js:472
throw err;
^

Error: Cannot find module '/usr/local/Cellar/node/7.9.0/bin'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:423:7)
at startup (bootstrap_node.js:147:9)
at bootstrap_node.js:538:3

Confusingly, in the blog you have an instruction to install react-native-cli globallly, with -g

But in the Run config screenshot further down the page you've pointed to a React native package in the local project's ('youtrack-mobile') node_modules/react-native-cli

My React native versions are:

react-native-cli: 2.0.1
react-native: 0.42.0

WebStorm 2017.1.2
Build #WS-171.4249.40, built on April 25, 2017
Subscription is active until November 30, 2017
JRE: 1.8.0_112-release-736-b21 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.4

0
1 comment

But the specified package location doesn't indeed look valid... It should be <npm prefix>/lib/node_modules/react-native-cli, like /usr/local/lib/node_modules/react-native-cli ('/usr/local' is a default npm prefix on MacOSX)

React Native CLI should normally be installed globally - see https://facebook.github.io/react-native/docs/getting-started.html#the-react-native-cli. And definitely you can't use project-local installation to create a project:) But youtrack-mobile project has cli installed as a local dependency - see https://github.com/JetBrains/youtrack-mobile/blob/master/package.json

0

Please sign in to leave a comment.