beansoft / react-native-console

🧩 an IDEA/WebStorm/Android Studio Plugin for One-Click run React Native commands in embed terminal
BSD 3-Clause "New" or "Revised" License
185 stars 28 forks source link

[OSX] No such file or directory on all rn commands #42

Closed Alex-Bond closed 4 years ago

Alex-Bond commented 4 years ago

Hi!

Caught some weird bug - React Native Console: Unable to run the commandline:Cannot run program "react-native" (in directory "/Users/alex/IdeaProjects/someRNProject"): error=2, No such file or directory

It used to work fine, but at some point stopped working. Maybe it's better to move node_modules/.bin to config so you can run commands from there?

Calling react-native from terminal wors fine. NPM/YARN works fine in terminal and plugin as well.

beansoft commented 4 years ago

Which your react native version is it? My plugin in find react-native command in the PATH env. I'd like to see the result of which react-native

Alex-Bond commented 4 years ago

Hey!

So, the RN version is 0.61.2.

Terminal:

When I'm outside of the project:

$ which react-native
react-native not found

Inside project:

$ which react-native
react-native not found

Inside project as well:

$ yarn react-native
yarn run v1.19.2
$ /Users/alex/CodingProjects/titanwinds/TitanWinds/node_modules/.bin/react-native
Usage: react-native [options] [command]

...rest of the help

Same but with npx:

$ npx react-native
Usage: react-native [options] [command]

Options:
  --version                       Print CLI version
  --verbose                       Increase logging verbosity
  -h, --help                      output usage information

...rest of the help

IDEA:

Terminal:

$ which react-native
/Users/alex/CodingProjects/titanwinds/TitanWinds/node_modules/.bin/react-native
$ react-native
Usage: react-native [options] [command]

Options:
  --version                       Print CLI version
  --verbose                       Increase logging verbosity
  -h, --help                      output usage information

...rest of the help
$ yarn react-native      
yarn run v1.19.2
$ /Users/alex/CodingProjects/titanwinds/TitanWinds/node_modules/.bin/react-native
Usage: react-native [options] [command]

Options:
  --version                       Print CLI version
  --verbose                       Increase logging verbosity
  -h, --help                      output usage information

...rest of the help
$ npx react-native  
Usage: react-native [options] [command]

Options:
  --version                       Print CLI version
  --verbose                       Increase logging verbosity
  -h, --help                      output usage information

...rest of the help

IDEA RN Console: Any command that requires react-native:

Unable to run the commandline:Cannot run program "react-native" (in directory "/Users/alex/CodingProjects/titanwinds/TitanWinds"): error=2, No such file or directory

Yarn, NPM and gradle commands work fine.

hzw1199 commented 4 years ago

I am in the same situation with @Alex-Bond

beansoft commented 4 years ago

i've found the reason, the latest RN 0.60+ no more relay on global rn cli. you can try npm install -g react-native-cli as a temporary fix, and i'll do a plugin update to compatible with both latest and old RN version.

beansoft commented 4 years ago

Fixed, try this plugin jar first: https://github.com/beansoftapp/react-native-console/blob/2019.2/react-native-console.jar

Alex-Bond commented 4 years ago

@beansoftapp works perfectly! Thank you!