Vscode-react-native: Could not debug. Seems to be that you are trying to debug from within directory that is not a React Native project root.

Created on 6 Feb 2019  ยท  10Comments  ยท  Source: microsoft/vscode-react-native

Actual Behavior

  1. Try to attach the packager
  2. See error below
OS: darwin x64
Adapter node: v8.9.3 x64
vscode-chrome-debug-core: 3.23.11
******** Unhandled error in debug adapter - Unhandled promise rejection: Error: spawn react-native ENOENT
    at _errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
Could not debug. Seems to be that you are trying to debug from within directory that is not a React Native project root. 
 If so, please, follow these instructions: https://github.com/Microsoft/vscode-react-native/blob/master/doc/customization.md#project-structure. (error code 604)

Expected Behavior

  1. Try to attach the packager
  2. Debugger should attach to the packager

Software versions

  • React-Native VS Code extension version: 0.8.0
  • VSCode version: Version 1.30.2 (1.30.2)
  • OS platform and version: 10.14.2
  • NodeJS version: v8.15.0
  • React Native version: 0.55.3
  • Expo SDK version (include if relevant): nope

Outputs (Include if relevant)

  • Output of the Debug Console (View -> Toggle Debug Console):
OS: darwin x64
Adapter node: v8.9.3 x64
vscode-chrome-debug-core: 3.23.11
******** Unhandled error in debug adapter - Unhandled promise rejection: Error: spawn react-native ENOENT
    at _errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
Could not debug. Seems to be that you are trying to debug from within directory that is not a React Native project root. 
 If so, please, follow these instructions: https://github.com/Microsoft/vscode-react-native/blob/master/doc/customization.md#project-structure. (error code 604)
  • Output of the React-Native output channel (View -> Toggle Output -> Select React-Native in ListBox):
PASTE OUTPUT HERE
  • Output of the Developer Tools console (Help -> Toggle Developer Tools -> Select Console tab):
[Extension Host] debugger listening on port 44769
extensionService.ts:505 Overwriting extension /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.node-debug2 with /Users/mlostek/.vscode/extensions/ms-vscode.node-debug2-1.31.3.
t._logMessageInConsole @ extensionService.ts:505
extensionHost.ts:235 Extension Host
extensionHost.ts:236 Debugger listening on ws://127.0.0.1:44769/9d1bd9e4-7cb9-41e0-9bdc-8e727790284b
For help see https://nodejs.org/en/docs/inspector

log.ts:157  INFO no standard startup: panel is active
console.ts:134 [Extension Host] [vscode-icons] v8.1.0 activated!
console.ts:134 [Extension Host] rejected promise not handled within 1 second
t.log @ console.ts:134
log.ts:169   ERR spawn react-native ENOENT: Error: spawn react-native ENOENT
    at _errnoException (util.js:1024:11)
    at Process.__dirname.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

I am having a react native project in the root of VSCode.

nvm question resolved

Most helpful comment

@mlostekk did you install react-native-cli globally for v8.15.0?

All 10 comments

Hi @mlostekk and thanks for contacting us. Do you use nvm?

Yes, it was always working fine.. till 2 weeks ago

Also when trying to use your recommended setting, i see thi
bildschirmfoto 2019-02-06 um 15 01 50

Ah, good hint... NVM using 8.15.0 does not work. But 8.11.1 works

Also when trying to use your recommended setting, i see thi
bildschirmfoto 2019-02-06 um 15 01 50

To override RNT settings please use react-native-tools.SETTING, where SETTING is parameter you want to override? in your case it'd be projectRoot:

image

Yes, it was always working fine.. till 2 weeks ago

Please, try to run node -v command in system terminal outside VS Code and using VS Code terminal. If versions are different then run nvm alias default NODE_VER, where NODE_VER is needed version of node, restart VS Code and check again.

Please let us know if it helps.

Regardless of the setting "react-native-tools.projectRoot": ".", its not working with 8.15.0 set via nvm alias. Its only working with 8.11.1

@mlostekk did you install react-native-cli globally for v8.15.0?

oh yes. sorry, that was my fault. did not do that! thank you for your quick help

PS D:\project\app> react-native run-windows
โˆš Found NuGet Binary
โˆš Found MSBuild v16.0 at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin (16.4.29806.167)

  • Restoring NuGetsC:\Users\jsvis\AppData\Local\Temp\nuget.4.9.2.exe
    โˆš Restoring NuGets
    โˆš Found MSBuild v16.0 at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin (16.4.29806.167)
    โˆš Found Solution: D:/project/app/windows/projectV1.sln
    i Build configuration: Debug
    i Build platform: x86
    Running MSBuild with args /clp:NoSummary;NoItemAndPropertyList;Verbosity=normal /nologo /p:Configuration=Debug /p:Platform=x86 /p:AppxBundle=Never /p:PlatformToolset=v141 /p:VisualStudioVersion=16.0 /bl

    • Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... / Building Solution: Adding file 'Microsoft.ReactNative.pdb'... - Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... / Building Solution: Adding file 'Microsoft.ReactNative.pdb'... - Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... / Building Solution: Adding file 'Microsoft.ReactNative.pdb'... - Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... / Building Solution: Adding file 'Microsoft.ReactNative.pdb'... - Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... / Building Solution: Adding file 'Microsoft.ReactNative.pdb'... - Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... / Building Solution: Adding file 'Microsoft.ReactNative.pdb'... - Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... / Building Solution: Adding file 'Microsoft.ReactNative.pdb'... - Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... / Building Solution: Adding file 'Microsoft.ReactNative.pdb'... - Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... / Building Solution: Adding file 'Microsoft.ReactNative.pdb'... - Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... / Building Solution: Adding file 'Microsoft.ReactNative.pdb'... - Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... / Building Solution: Adding file 'Microsoft.ReactNative.pdb'... - Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... / Building Solution: Adding file 'Microsoft.ReactNative.pdb'... - Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... / Building Solution: Adding file 'Microsoft.ReactNative.pdb'... - Building Solution: Adding file 'Microsoft.ReactNative.pdb'... \ Building Solution: Adding file 'Microsoft.ReactNative.pdb'... | Building Solution: Adding file 'Microsoft.ReactNative.pdb'... โˆš Building Solution

      โˆš Starting the React-Native Server

      โˆš Removing old version of the app

      โˆš Enabling Developer Mode

      โˆš Installing new version of the app

      ร— Failed to deploy: Fail to check the installed app, maybe developer mode is off on Windows

      PS D:\project\app>

I have turned on my Developer mode also
still getting this error

Also running using visual studio 2019
it is showing this error
i could not resolve this error

Loading dependency graph, done.
error: bundling failed: ReferenceError: SHA-1 for file D:\project\app\node_modules\react-native\package.json (D:\project\app\node_modules\react-native\package.json) is not computed
at DependencyGraph.getSha1 (D:\project\App\node_modules\metro\src\node-haste\DependencyGraph.js:259:13)
at D:\project\App\node_modules\metro\src\DeltaBundler\Transformer.js:211:26
at Generator.next ()
at asyncGeneratorStep (D:\project\App\node_modules\metro\src\DeltaBundler\Transformer.js:46:24)
at _next (D:\project\App\node_modules\metro\src\DeltaBundler\Transformer.js:66:9)
at D:\project\App\node_modules\metro\src\DeltaBundler\Transformer.js:71:7
at new Promise ()
at D:\project\App\node_modules\metro\src\DeltaBundler\Transformer.js:63:12
at Transformer.transformFile (D:\project\App\node_modules\metro\src\DeltaBundler\Transformer.js:236:7)
at D:\project\App\node_modules\metro\src\Bundler.js:87:34
BUNDLE [windows, dev] ./index.js โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–‘โ–‘โ–‘โ–‘ 81.1% (1222/1357), failed.

::1 - - [11/Mar/2020:06:13:44 +0000] "GET /index.bundle?platform=windows&dev=true&hot=false&inlineSourceMap=true HTTP/1.1" 500 - "-" "-"
error: bundling failed: ReferenceError: SHA-1 for file D:\project\app\node_modules\react-native\package.json (D:\project\app\node_modules\react-native\package.json) is not computed
at DependencyGraph.getSha1 (D:\project\App\node_modules\metro\src\node-haste\DependencyGraph.js:259:13)
at D:\project\App\node_modules\metro\src\DeltaBundler\Transformer.js:211:26
at Generator.next ()
at asyncGeneratorStep (D:\project\App\node_modules\metro\src\DeltaBundler\Transformer.js:46:24)
at _next (D:\project\App\node_modules\metro\src\DeltaBundler\Transformer.js:66:9)
at D:\project\App\node_modules\metro\src\DeltaBundler\Transformer.js:71:7
at new Promise ()
at D:\project\App\node_modules\metro\src\DeltaBundler\Transformer.js:63:12
at Transformer.transformFile (D:\project\App\node_modules\metro\src\DeltaBundler\Transformer.js:236:7)
at D:\project\App\node_modules\metro\src\Bundler.js:87:34
BUNDLE [windows, dev] ./index.js โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 0.0% (0/1)
::1 - - [11/Mar/2020:06:13:44 +0000] "GET /index.bundle?platform=windows&dev=true&hot=false&inlineSourceMap=true HTTP/1.1" 500 - BUNDLE [windows, dev] ./index.js โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 0.0% (0/1),
failed.

Hi @ARJUN-JAKKA . The first issue looks similar to #1152, and it is not connected to the extension since it is reproduced even without the extension. With respect to errors with building in Visual Studio, I'm afraid that this is not the correct place for resolving such questions. I suppose that it is better to ask your questions in React Native for Windows repository. Feel free to open new issues if they are about debugging React Native apps with React Native Tools extension in VS Code.

Was this page helpful?
0 / 5 - 0 ratings