Vscode-js-debug: Support nodenv in the nvm resolver or binary provider

Created on 17 Sep 2020  路  4Comments  路  Source: microsoft/vscode-js-debug

Describe the bug
I can no longer debug apps that don't use at least node12, when using nodenv

To Reproduce
Steps to reproduce the behavior:

  1. Install nodenv
  2. Make your default node version >= 12.x
  3. Make an app that uses a .node-version file to use 10.x for it
  4. Make a launch config to debug this app
  5. Try to debug it. It fails because it's trying to use the node 12.x --inspect-publish-uid flag with node 10

VS Code Version: 1.49.0

Additional context
The problem seems to be that the feature enabled in
https://github.com/microsoft/vscode-js-debug/commit/32244ec6b0c979f79a1808cbb506e6ef5900d6b2
relies on resolveAndValidate here
https://github.com/microsoft/vscode-js-debug/blob/2518eeb26140ef2d3c0254056614bf335b7a29d3/src/targets/node/nodeBinaryProvider.ts#L128
And that code doesn't understand that the node binary in use may depend on the working directory, not just PATH from the environment.

feature-request help welcome

Most helpful comment

A workaround for you is to add nodeVersionHint: 10 to your launch.json. A more correct fix would be to support nodenv in the NvmResolver (todo: should be refactored to be a little more modular) or NodeBinaryProvider to resolve the binary statically there.

All 4 comments

A workaround for you is to add nodeVersionHint: 10 to your launch.json. A more correct fix would be to support nodenv in the NvmResolver (todo: should be refactored to be a little more modular) or NodeBinaryProvider to resolve the binary statically there.

Fyi there was a bug in the binary provider, you'll need to use the next nightly for the hint to work.

A workaround for you is to add nodeVersionHint: 10 to your package.json

I think you meant to add it to launch.json?

yes, fixed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KieranHarper picture KieranHarper  路  5Comments

ArzelaAscoIi picture ArzelaAscoIi  路  5Comments

roblourens picture roblourens  路  5Comments

Agamennon picture Agamennon  路  4Comments

egorshulga picture egorshulga  路  8Comments