microsoft / vscode-react-native

VSCode extension for React Native - supports debugging and editor integration
https://marketplace.visualstudio.com/items?itemName=vsmobile.vscode-react-native
Other
2.62k stars 264 forks source link

Fail to start debugging: Spawn react-native ENOENT when starting "Debug iOS" #597

Closed omdv closed 6 years ago

omdv commented 6 years ago

Actual Behavior

This issue appeared just recently, I can't track it back to any upgrades or changes I did.

When trying to start debugging (iOS mode) I get the following error: Error while executing command 'react-native run-ios --simulator --no-packager': spawn react-native ENOENT

Software versions

Outputs (Include if relevant)

Scanning 1095 folders for symlinks in /Users/om/Documents/react-native/cryptofolio/node_modules (18ms) ┌────────────────────────────────────────────────────────────────────────────┐ │ Running packager on port 8081. │ │ │ │ Keep this packager running while developing on any JS projects. Feel │ │ free to close this tab and run your own packager instance if you │ │ prefer. │ │ │ │ https://github.com/facebook/react-native │ │ │ └────────────────────────────────────────────────────────────────────────────┘ Looking for JS files in /Users/om/Documents/react-native/cryptofolio

React packager ready.

Loading dependency graph, done. [Info] Packager started.

[Info] Prewarming bundle cache. This may take a while ...

[Info] About to get: http://localhost:8081/index.ios.bundle?platform=ios

Bundling index.ios.js [development, non-minified, hmr disabled] 100.0% (1580/1580), done. [Warning] The Bundle Cache was prewarmed.

[Info] Building and running application.

[Error] Error: Error while executing command 'react-native run-ios --simulator --no-packager': spawn react-native ENOENT

- Output of the Developer Tools console (Help -> Toggle Developer Tools -> Select Console tab):

/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] ApplicationInsights:Sender Array(1) t.log @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:9 /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] (node:7128) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead. t.log @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:9 /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:9 [Extension Host] ApplicationInsights:Sender Array(1)



Other notes
1. `react-native run-ios` works fine from terminal
2. `.vscode/.react` folder is created on starting VS code, it is empty though
2. calling `code .` from terminal as suggested in some responses to similar issues does not help
wilomgfx commented 6 years ago

I can confirm i get the same thing by just trying to launch my iOS app from vscode.

callagga commented 6 years ago

I'm getting this on one of my IOS projects too: [Info] Building and running application. [Error] Error: Error while executing command 'react-native run-ios --simulator --no-packager': Error while executing command 'react-native run-ios --simulator --no-packager'

I just noted a project that worked has "Metro Bundler ready" listed during the startup, whereas the project that is not working has "React packager ready".

I'm not sure however how you get the "Metro Bundler" selected (or what this is). Both launch.json entries seem to be the same??/

wilomgfx commented 6 years ago

@callagga React packager is the old packager. React native (new versions) use Metro Bundler instead. Upgrade your old project.

callagga commented 6 years ago

oh - ok so basically it's a "react native" upgrade you're referring to here right?

wilomgfx commented 6 years ago

@callagga yes.

callagga commented 6 years ago

many thanks

omdv commented 6 years ago

confirm that the issue is gone. Was fixed 12 days ago by https://github.com/Microsoft/vscode-react-native/pull/600 Thanks.

romk1n commented 6 years ago

I am using vscode - Version 1.18.1 (1.18.1) and latest plugin and still see the issue, ay idea how to fix it?

itoys commented 6 years ago

Hi @romk1n Does react-native run-ios --simulator command work fine in terminal? Could you please provide some outputs and software versions?

romk1n commented 6 years ago

@iTOYS yeah it does. .what kind of info you need ?

OS: darwin x64
Adapter node: v7.9.0 x64
vscode-chrome-debug-core: 3.18.5
Could not debug. Error while executing command 'react-native run-ios --simulator --no-packager': Error while executing command 'react-native run-ios --simulator --no-packager'
react-native tools 0.5.7
react-native-cli: 2.0.1
react-native: 0.50.3
nodjs - v8.9.1
Mac OSX - 10.13.1
itoys commented 6 years ago

@romk1n

BTW, i couldn't repro this issue after 0.5.7 release