Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current workspace does not contain React Native projects #1012

Closed
pt8o opened this issue May 22, 2019 · 48 comments
Closed

Current workspace does not contain React Native projects #1012

pt8o opened this issue May 22, 2019 · 48 comments
Assignees

Comments

@pt8o
Copy link

@pt8o pt8o commented May 22, 2019

Actual Behavior

  • Run React Native: Start Packager
    • "Error while working with workspace: Current workspace does not contain React Native projects. (error code 710)"
  • Run Debug: Start Debugging
    • Debug sidebar shows progress bar for a few seconds then stops
    • Log (Window) says "Error: spawn react-native ENOENT"

Expected Behavior

  • React Native project launches with debugger attached

Software versions

  • React-Native VS Code extension version: 0.9.3
  • VSCode version: 1.34.0
  • OS platform and version: Pop!_OS 19.04
  • NodeJS version: 11.14.0
  • React Native version: 0.58.6
  • Expo SDK version (include if relevant):

Outputs (Include if relevant)

  • Output of the Debug Console (View -> Toggle Debug Console):
(it's empty)
  • Output of the React-Native output channel (View -> Toggle Output -> Select React-Native in ListBox):
[Error] Failed to start the React Native packager (error code 106)

Stack: Error: Failed to start the React Native packager (error code 106): Error while working with workspace: Current workspace does not contain React Native projects. (error code 710)
	at Function.getWrappedError (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/src/common/error/internalError.js:35:16)
	at Function.wrapError (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/src/common/error/errorHelper.js:17:44)
	at handleErrors.resultOfCode.done.reason (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/src/common/entryPointHandler.js:43:72)
	at _rejected (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/node_modules/q/q.js:844:24)
	at /home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/node_modules/q/q.js:870:30
	at Promise.when (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/node_modules/q/q.js:1122:31)
	at Promise.promise.promiseDispatch (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/node_modules/q/q.js:788:41)
	at /home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/node_modules/q/q.js:604:44
	at runSingle (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/node_modules/q/q.js:137:13)
	at flush (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/node_modules/q/q.js:125:13)
	at process._tickCallback (internal/process/next_tick.js:61:11)

  • Output of the Developer Tools console (Help -> Toggle Developer Tools -> Select Console tab):
[Extension Host] debugger listening on port 62927
workbench.main.js:4342 Overwriting grammar scope name to file mapping for scope source.swift.
Old grammar file: file:///usr/share/code/resources/app/extensions/swift/syntaxes/swift.tmLanguage.json.
New grammar file: file:///home/lh/.vscode/extensions/kasik96.swift-0.0.3/syntaxes/swift.tmLanguage
register @ workbench.main.js:4342
workbench.main.js:238 [Extension Host] (node:31773) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
t.log @ workbench.main.js:238
workbench.main.js:2365 Error: Error while working with workspace: Current workspace does not contain React Native projects. (error code 710)
	at Function.getInternalError (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/src/common/error/errorHelper.js:10)
	at Function.selectProject (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/src/extension/commandPaletteHandler.js:332)
	at Function.startPackager (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/src/extension/commandPaletteHandler.js:37)
	at registerVSCodeCommand (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/src/extension/rn-extension.js:181)
	at generate.generator.time (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/src/common/telemetryHelper.js:61)
	at TelemetryGenerator.time (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/src/common/telemetryGenerators.js:54)
	at Function.generate (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/src/common/telemetryHelper.js:61)
	at EntryPointHandler.runFunctionWExtProps (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/src/common/entryPointHandler.js:26)
	at context.subscriptions.push.vscode.commands.registerCommand (/home/lh/.vscode/extensions/msjsdiag.vscode-react-native-0.9.3/src/extension/rn-extension.js:198)
	at d._executeContributedCommand (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:492)
	at d.$executeContributedCommand (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:492)
	at d._doInvokeHandler (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:637)
	at d._invokeHandler (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:637)
	at d._receiveRequest (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:636)
	at d._receiveOneMessage (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:635)
	at define.constructor._protocol.onMessage.e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:633)
	at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:47)
	at e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:43)
	at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:47)
	at a (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:175)
	at e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:175)
	at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:47)
	at y._receiveMessage (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:184)
	at define.constructor._socketDisposables.push._socketReader.onMessage.e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:181)
	at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:47)
	at f.acceptChunk (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:178)
	at define.constructor._register._socket.onData.e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:177)
	at Socket.t (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:186)
	at Socket.emit (events.js:182)
	at addChunk (_stream_readable.js:279)
	at readableAddChunk (_stream_readable.js:264)
	at Socket.Readable.push (_stream_readable.js:219)
	at Pipe.onread (net.js:636)
onDidNotificationChange @ workbench.main.js:2365
workbench.main.js:238 [Extension Host] rejected promise not handled within 1 second: Error: spawn react-native ENOENT
t.log @ workbench.main.js:238
workbench.main.js:238 [Extension Host] stack trace: Error: spawn react-native ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:229:19)
	at onErrorNT (internal/child_process.js:406:16)
	at process._tickCallback (internal/process/next_tick.js:63:19)
t.log @ workbench.main.js:238
workbench.main.js:1402   ERR spawn react-native ENOENT: Error: spawn react-native ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:229:19)
	at onErrorNT (internal/child_process.js:406:16)
	at process._tickCallback (internal/process/next_tick.js:63:19)
workbench.main.js:238 [Extension Host] (node:31773) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
@pt8o

This comment has been minimized.

Copy link
Author

@pt8o pt8o commented May 22, 2019

Apologies if this issue is really vague... I'm just not able to launch a React Native project with the VS Code debugger attached. Regular react-native run-android works fine.

I've confirmed that this same project is working on macOS, so something specific about my Linux environment is making it not recognize the current workspace.

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented May 22, 2019

Hi @pt8o and thanks for reaching us. Seems to be you are missing global react-native cli. Do you use nvm?

@ruslan-bikkinin ruslan-bikkinin self-assigned this May 22, 2019
@pt8o

This comment has been minimized.

Copy link
Author

@pt8o pt8o commented May 22, 2019

Hi @ruslan-bikkinin , yep I use nvm, currently have version 0.34.0.

Also, I did npm install -g react-native-cli, which should have installed it globally, yeah?

In my home directory the react-native command is recognized

$ react-native -v
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory
@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented May 22, 2019

@pt8o the node version is used inside VS Code my differ with the system one which is known issue for VS Code and nvm, and I am suspecting that this is your case. To check please run node -v in system terminal and in VS Code terminal and if node versions are different then simply run nvm alias default YOUR_SYSTEM_NODE_VERSION. After that run npm install -g react-native-cli on system node and restart VS Code.

@pt8o

This comment has been minimized.

Copy link
Author

@pt8o pt8o commented May 22, 2019

node -v on both system Terminal and VS Code terminal prints v11.14.0

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented May 23, 2019

And you still can't debug your app after installing React Native cli globally on 11.14.0?

@thibmaek

This comment has been minimized.

Copy link

@thibmaek thibmaek commented May 23, 2019

It seems that since this extension moved from the "vsmobile.vscode-react-native" to "msjsdiag.vscode-react-native" namespace this is broken.

  • Worked fine before, did not upgrade node, react-native-cli or react-native version
  • Installing latest react-native-cli does not work.
  • Node version: 10
  • No nvm (using brew)
  • react-native -v prints react-native: 0.57.5 so detects valid project
@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented May 23, 2019

@thibmaek what version of extension do you use? Do you open exactly the same folder/workspace as before? If you reinstall the extension the problem is still appear?

@pt8o

This comment has been minimized.

Copy link
Author

@pt8o pt8o commented May 23, 2019

@ruslan-bikkinin correct, react-native-cli is installed globally. react-native -v returns react-native-cli: 2.0.1 on both OS terminal and VS Code terminal. "Start Debugging" or "Start Packager" give the same error messages as above.

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented May 23, 2019

@pt8o could you please send a screenshot of file structure of workspace you open in VS Code?

@pt8o

This comment has been minimized.

Copy link
Author

@pt8o pt8o commented May 23, 2019

@ruslan-bikkinin just like this?
Screenshot from 2019-05-23 09-45-00

@thibmaek

This comment has been minimized.

Copy link

@thibmaek thibmaek commented May 23, 2019

Fix for me:

  1. npm cache clean --force
  2. npm i -g react-native-cli@latest
  3. Reinstall extension
  4. Reload VS Code
@pt8o

This comment has been minimized.

Copy link
Author

@pt8o pt8o commented May 23, 2019

@thibmaek thank you for the suggestion, this didn't work for me -- still the same error messages as in the original post

@thibmaek

This comment has been minimized.

Copy link

@thibmaek thibmaek commented May 24, 2019

Yeah mine stopped working again

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented May 24, 2019

@thibmaek @pt8o guys, could you please open your project in VS Code, then open VS Code terminal, run react-native --version and share output with me?
@pt8o also, could you please share .vscode/settings.json content with me?

In general, "Error: spawn react-native ENOENT" signals that react-native command is not available from within VS Code process and it's environment problem.

@pt8o

This comment has been minimized.

Copy link
Author

@pt8o pt8o commented May 24, 2019

In VS Code terminal
Screenshot from 2019-05-24 10-16-35

The full content of .vscode/settings.json is

{
  "editor.insertSpaces": true,
  "editor.tabSize": 2,
  "java.configuration.updateBuildConfiguration": "disabled"
}
@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented May 27, 2019

@pt8o looks like everything is okay there. Could you please run nvm ls and share the output with me?

@thibmaek

This comment has been minimized.

Copy link

@thibmaek thibmaek commented May 27, 2019

$ react-native --version
react-native-cli: 2.0.1
react-native: 0.57.5
{
  "javascript.validate.enable": false,
  "flow.useNPMPackagedFlow": true
}
@pt8o

This comment has been minimized.

Copy link
Author

@pt8o pt8o commented May 27, 2019

@ruslan-bikkinin
nvm ls gives

        v11.0.0
->     v11.14.0
         system
default -> 11 (-> v11.14.0)
node -> stable (-> v11.14.0) (default)
stable -> 11.14 (-> v11.14.0) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/dubnium (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.16.0 (-> N/A)
lts/dubnium -> v10.15.3 (-> N/A)

on both system and VS Code terminals

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented May 27, 2019

@pt8o are you sure that you don't have any other node installations traces in your system except related to nvm? Also, please check VS Code docs section. Problem described there may seem to be unrelated, but I am guessing the cause of your issue and @thibmaek is the same as there.

@pt8o

This comment has been minimized.

Copy link
Author

@pt8o pt8o commented May 27, 2019

Hi @ruslan-bikkinin, I've fully removed all node and npm from my /usr/ folders and then reinstalled everything with nvm. Still getting the same error :(

@thibmaek

This comment has been minimized.

Copy link

@thibmaek thibmaek commented May 27, 2019

I don't even use nvm.

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented May 29, 2019

@pt8o @thibmaek I added logging of process.env before each react-native command call. Could you please try it? Please do the following steps:

  • Uninstall extension installed from Market place
  • Restart VS Code
  • Download archive I prepared: vscode-react-native-0.9.3.vsix.zip, rename it to vscode-react-native-0.9.3.vsix
  • Install VSIX manually (Open VS Code, click Extensions icon, then click on ... and select Install From VSIX)
  • Try to debug and get the error.
  • Open Developer Tools Help -> Toggle Developer Tools
  • You will see logged process.env object.
  • Go through PATH value of the object and make sure that it is correct and
    • @pt8o - you have /home/username/.nvm/versions/node/v11.14.0/bin there
    • @pt8o and @thibmaek no other directories listed there could override path to the main node instance (i.e. no other node exists in the paths)
@Unforgiven-wanda

This comment has been minimized.

Copy link

@Unforgiven-wanda Unforgiven-wanda commented Jun 2, 2019

Having the same issue and pretty much the same results so far.
EDIT: In my case it seems it was a faulty vscode installation (I am on Arch linux) I simply reinstalled the whole shebang from a different provider and now it works.

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented Jun 3, 2019

@pt8o @thibmaek hi guys, do you have a chance to look at this?

@pt8o

This comment has been minimized.

Copy link
Author

@pt8o pt8o commented Jun 3, 2019

Hi @ruslan-bikkinin , thanks for following up.

I just tried the VSIX file you provided. I don't see a logged process.env object, I don't think?

I get this:

workbench.main.js:238 [Extension Host] rejected promise not handled within 1 second: Error: spawn react-native ENOENT
t.log @ workbench.main.js:238
$logExtensionHostMessage @ workbench.main.js:3178
_doInvokeHandler @ workbench.main.js:3252
_invokeHandler @ workbench.main.js:3252
_receiveRequest @ workbench.main.js:3251
_receiveOneMessage @ workbench.main.js:3249
_protocol.onMessage.e @ workbench.main.js:3248
fire @ workbench.main.js:77
a @ workbench.main.js:321
e @ workbench.main.js:321
fire @ workbench.main.js:77
_receiveMessage @ workbench.main.js:330
S._socketDisposables.push._socketReader.onMessage.e @ workbench.main.js:327
fire @ workbench.main.js:77
acceptChunk @ workbench.main.js:323
_register._socket.onData.e @ workbench.main.js:323
t @ workbench.main.js:332
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
workbench.main.js:238 [Extension Host] stack trace: Error: spawn react-native ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:229:19)
	at onErrorNT (internal/child_process.js:406:16)
	at process._tickCallback (internal/process/next_tick.js:63:19)
t.log @ workbench.main.js:238
$logExtensionHostMessage @ workbench.main.js:3178
_doInvokeHandler @ workbench.main.js:3252
_invokeHandler @ workbench.main.js:3252
_receiveRequest @ workbench.main.js:3251
_receiveOneMessage @ workbench.main.js:3249
_protocol.onMessage.e @ workbench.main.js:3248
fire @ workbench.main.js:77
a @ workbench.main.js:321
e @ workbench.main.js:321
fire @ workbench.main.js:77
_receiveMessage @ workbench.main.js:330
S._socketDisposables.push._socketReader.onMessage.e @ workbench.main.js:327
fire @ workbench.main.js:77
acceptChunk @ workbench.main.js:323
_register._socket.onData.e @ workbench.main.js:323
t @ workbench.main.js:332
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
workbench.main.js:1402   ERR spawn react-native ENOENT: Error: spawn react-native ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:229:19)
	at onErrorNT (internal/child_process.js:406:16)
	at process._tickCallback (internal/process/next_tick.js:63:19)
@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented Jun 4, 2019

@pt8o yes, that was the wrong one. Here is the correct VSIX: vscode-react-native-0.9.3.vsix.zip

I updated my previous comment.

@thibmaek

This comment has been minimized.

Copy link

@thibmaek thibmaek commented Jun 5, 2019

Error: ERR spawn react-native ENOENT: Error: spawn react-native ENOENT


PATH:

  • DevTools: "/usr/bin:/bin:/usr/sbin:/sbin"
  • echo $PATH in VS Code terminal: /usr/local/opt/node@10/bin:/usr/local/opt/curl/bin:/Users/thibault/bin:/usr/local/sbin:/usr/local/opt/gpg-agent/bin:/usr/local/opt/python/libexec/bin:/Users/thibault/.rbenv/shims:/Users/thibault/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Users/thibault/Library/Android/sdk/tools:/Users/thibault/Library/Android/sdk/tools/bin:/Users/thibault/Library/Android/sdk/platform-tools:/usr/local/opt/go/libexec/bin:/Applications/Sketch.app/Contents/Resources/sketchtool/bin

Brew:

  • brew ls | grep node: node, node@10, node@8
  • in my .profile: export PATH="/usr/local/opt/node@10/bin:$PATH"

Even though I installed node@latest and node@8, they are not in my PATH, since I source node@10.

As an extra node, I have been working with this method of node version for over 2 years and had no issues with the extension until recently when it moved to the msjdiag org.

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented Jun 20, 2019

@thibmaek looks like PATH that is passed to VS Code process differs from the one that defined in your system. Under the hood there are two times when env is passed during the debugging:
First time, on VS Code side when spawning extension host process:
https://github.com/microsoft/vscode/blob/e1ac9a2490eff941c56f666800e29987c7276a67/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts#L131
Second time, in the extension when spawning react-native process (env is undefined, which means that parent process.env will be used):

const result = this.childProcess.spawn(reactCommand,

So, this is local configuration problem, not the extension one. It's hard to say why it was working in your case before 0.9.3 release, because a lot of possible changes could had influenced your environment that may affect PATH. i'd suggest you to move export PATH="/usr/local/opt/node@10/bin:$PATH" from .profile to .bash_profile because .profile would be the last one for checking by OS and would be ignored if bash_profile exists already.

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented Jun 20, 2019

@pt8o did you have a chance to try updated VSIX?

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented Jul 3, 2019

I am closing this due to inactivity. Feel free to re-open if needed.

@CyberMew

This comment has been minimized.

Copy link

@CyberMew CyberMew commented Jul 13, 2019

I am having this issue too, I have installed the react-native-cli, react-native -v gives:

react-native-cli: 2.0.1
react-native: 0.59.8

and node -v gives:

v10.15.3

My workspace folder is the react-native project itself (package.json is root of this folder).

Following instructions to enable debugging is not working, it just processes for a few seconds and disappears. I have React Native Tools v0.10.1 installed. This is my launch.json:

{
      "name": "Attach to packager",
      "cwd": "${workspaceFolder}",
      "type": "reactnative",
      "request": "attach",
      "address": "127.0.0.1"
    },

We are using node node_modules/react-native/local-cli/cli.js start (npm start) to start the metro bundler and the server basically.

Debugging remotely (I'm using iOS simulator) basically just launches Chrome tab. (which btw loads localhost:8081 instead of 127.0.0.1:8081 which causes a CORS issue, not sure if it's our config issue or react-native issue).

In frustration, I manage to find and launch React Native: Start Packager and I got this same workspace not found 710 error.

However upon installing your debug .vsix file, and restarting the workspace/app, it magically works!

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented Jul 16, 2019

@CyberMew could you please try to use the previous versions of the extension and let us know on which version you have no error:

  • 0.9.3
  • 0.10.0

To install previous version of the extension you need to

  • open extension page in VS Code
  • click right mouse button, select "Install Another Version.."
    image
  • Then choose needed version in the menu
@mjgerace

This comment has been minimized.

Copy link

@mjgerace mjgerace commented Jul 19, 2019

I was having the same exact issue as above, installation versions matched in outside terminal and vscode terminal, same debug issue as well. Just rolled back to 10.0.0 and things are working great. Perhaps there was a regression?

@DananDio

This comment has been minimized.

Copy link

@DananDio DananDio commented Jul 23, 2019

any suggestion? i was having the same issue for this, already try with ver 0.9.3 and 0.10.0, can't use tools

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented Jul 24, 2019

@DananDio @mjgerace if you see "Error: spawn react-native ENOENT" in Developer Tools logs it means that react-native command is not available in the PATH provided to the VS Code process. It's nothing to do with extension itself.
I'd recommend you to check your system configuration. You can check what is passed into the PATH variable that is used in VS Code by following these steps:

  • Open Developer Tools console in VS Code (Help -> Toggle Developer Tools -> Select Console tab)
  • Type process.env.PATH.split(":"); command in the console and call it
  • Then you need to check every directory that is listed in the resulted array to find which one contains node or npm executable. If you have multiple such directories then you need to figure out which are excess ones , why they have been added to the PATH and how to get rid of them.
@pt8o

This comment has been minimized.

Copy link
Author

@pt8o pt8o commented Jul 24, 2019

Sorry for the long delay @ruslan-bikkinin! The issue for me in the end was that that nvm paths were in my bash_profile but not my bashrc... or it may have been the other way around, I don't remember specifically. Apparently the OS terminal loads both, and the regular built in terminal in VS Code loads both, but the specific environment used by the React Native debugger only loads one of them.

@pheuter

This comment has been minimized.

Copy link

@pheuter pheuter commented Jul 24, 2019

I encounter this issue when using the Visual Studio Code Remote - Containers extension and installing the vscode-react-native extension inside the container. In the container I have node installed without using nvm.

@DananDio

This comment has been minimized.

Copy link

@DananDio DananDio commented Jul 25, 2019

@ruslan-bikkinin i could provide run npm on vscode terminal and outside vscode , and the only error gor every time i run react-native tools is this :

[Error] Failed to run the application in Android (error code 104)

Stack: Error: Failed to run the application in Android (error code 104): Error while working with workspace: Current workspace does not contain React Native projects. (error code 710)
at Function.getWrappedError (/Users/danandio/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/src/common/error/internalError.js:35:16)
at Function.wrapError (/Users/danandio/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/src/common/error/errorHelper.js:17:44)
at handleErrors.resultOfCode.done.reason (/Users/danandio/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/src/common/entryPointHandler.js:43:72)
at _rejected (/Users/danandio/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:844:24)
at /Users/danandio/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:870:30
at Promise.when (/Users/danandio/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:1122:31)
at Promise.promise.promiseDispatch (/Users/danandio/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:788:41)
at /Users/danandio/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:604:44
at runSingle (/Users/danandio/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:137:13)
at flush (/Users/danandio/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:125:13)
at process._tickCallback (internal/process/next_tick.js:61:11)

feels weird because i could run and live reload with vscode +emu, but can't with this extension

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented Jul 25, 2019

@DananDio please try follow the instructions from my comment: #1012 (comment)

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented Jul 25, 2019

@pheuter thanks for letting us know! I think we should triage that.

@thibmaek

This comment has been minimized.

Copy link

@thibmaek thibmaek commented Aug 22, 2019

I have no clue how to fix this but will list my setup again:

  • In my vscode settings: "terminal.integrated.shell.osx": "/usr/local/bin/zsh",
  • In my .zshrc: export PATH="/usr/local/opt/node@10/bin:$PATH"
  • When logging path via vscode devtools: (4) ["/usr/bin", "/bin", "/usr/sbin", "/sbin"]
  • When logging PATH via integrated shell: /usr/local/opt/node@10/bin:/Users/thibault.maekelbergh/.rbenv/shims:/Users/thibault.maekelbergh/.rbenv/bin:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/usr/local/opt/node@10/bin:/Users/thibault.maekelbergh/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/thibault.maekelbergh/Library/Android/sdk/tools:/Users/thibault.maekelbergh/Library/Android/sdk/tools/bin:/Users/thibault.maekelbergh/Library/Android/sdk/platform-tools:/Applications/Sketch.app/Contents/Resources/sketchtool/bin
  • node installed via brew
@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented Aug 22, 2019

@thibmaek as you can see PATH that is being exposed to VS Code differs from the PATH that is being exposed to integrated shell. For some reason PATH export defined in .zshrc isn't engaged by VS Code when it's started. I think, you can try to workaround it by doubling the export in .bash_profile.

@thibmaek

This comment has been minimized.

Copy link

@thibmaek thibmaek commented Aug 22, 2019

@ruslan-bikkinin putting the export in .bash_profile yields the same result

@ruslan-bikkinin

This comment has been minimized.

Copy link
Collaborator

@ruslan-bikkinin ruslan-bikkinin commented Aug 23, 2019

@thibmaek understood. I'd suggest you to reach out VS Code team then because this is more likely zsh/VS Code issue than an extension one.

@afshawnlotfi

This comment has been minimized.

Copy link

@afshawnlotfi afshawnlotfi commented Sep 6, 2019

I am having the same problem. Anyone found a solution or workaround

@AndrewMorsillo

This comment has been minimized.

Copy link

@AndrewMorsillo AndrewMorsillo commented Sep 12, 2019

Also having this issue. react-native, node, and npm are on the path confirmed from the developer tools. Not really sure what's going on here.

@thibmaek

This comment has been minimized.

Copy link

@thibmaek thibmaek commented Nov 6, 2019

I have finally found what causes this issue.
Launching VS Code with code folder/ in my shell makes the RN extension work 100% of the time (using ZSH).

Launching VS Code from anywhere else (bash, finder, alfred workflow) never works in conjunction with RN extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.