vscode-react-native icon indicating copy to clipboard operation
vscode-react-native copied to clipboard

Current workspace does not contain React Native projects

Open pt8o opened this issue 7 years ago • 50 comments

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 avatar May 22 '19 15:05 pt8o

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

ruslan-bikkinin avatar Jul 25 '19 15:07 ruslan-bikkinin

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

thibmaek avatar Aug 22 '19 08:08 thibmaek

@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.

ruslan-bikkinin avatar Aug 22 '19 09:08 ruslan-bikkinin

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

thibmaek avatar Aug 22 '19 11:08 thibmaek

@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.

ruslan-bikkinin avatar Aug 23 '19 10:08 ruslan-bikkinin

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

afshawnlotfi avatar Sep 06 '19 02:09 afshawnlotfi

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.

evelant avatar Sep 12 '19 17:09 evelant

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

thibmaek avatar Nov 06 '19 12:11 thibmaek

I fixed this by change my wifi to use my phone 4G. But when i change my wifi to office.The problem also with me. So i don't know what the question now!!

iosToTop avatar Apr 29 '20 06:04 iosToTop

Hi @iosToTop, please open a new issue according to our issue template and describe your problem in details.

RedMickey avatar Apr 29 '20 07:04 RedMickey