Vscode-js-debug: Error: Cannot find module '"/Applications/Visual'

Created on 19 Jan 2021  路  5Comments  路  Source: microsoft/vscode-js-debug

Describe the bug
upgraded version of node today
now i get this error message when i run
i'm using npm as runtimeExecutable in my launch.json

To Reproduce
Steps to reproduce the behavior:

Click on Launch via NPM from within code
internal/modules/cjs/loader.js:583
throw err;
^

Error: Cannot find module '"/Applications/Visual'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at Module._preloadModules (internal/modules/cjs/loader.js:812:12)
at preloadModules (internal/bootstrap/node.js:599:7)
at startup (internal/bootstrap/node.js:273:9)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

trace file sent via email

Log File

VS Code Version: Replace me!

Additional context
Add any other context about the problem here.

bug

Most helpful comment

It looks like you have a copy of Node.js installed in ./node_modules/.bin/node -- and since you're running with npm, we fall back and see Node there.

I recommend either:

  • Uninstalling the copy of Node.js from your node_modules if it's not actually the version of node you want to run with
  • Configure npm to use the copy of Node.js present in your node_modules (e.g. install npm locally as well and invoke that)
  • Manually set nodeVersionHint: 10 to indicate you're running with the old version of Node.js

All 5 comments

Version: 1.52.1
Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523
Date: 2020-12-16T16:30:02.420Z
Electron: 9.3.5
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 20.2.0

@michaelhyman
thanks for open the new issue.


output log

/Users/niioka-kenshiro/.anyenv/envs/nodenv/shims/node ./myProjectDir/index.js
internal/modules/cjs/loader.js:582
    throw err;
    ^

Error: Cannot find module '"/Applications/Visual'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at Module._preloadModules (internal/modules/cjs/loader.js:811:12)
    at preloadModules (internal/bootstrap/node.js:594:7)
    at startup (internal/bootstrap/node.js:275:9)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
Process exited with code 1

launch.json

I created this file by referring to the following URL and selected Node.js(preview).
I only modified the program part.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "pwa-node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${workspaceFolder}/myProjectDir/index.js"
        }
    ]
}

About my VSCode

Version: 1.52.1
Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523
Date: 2020-12-16T16:30:02.420Z
Electron: 9.3.5
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 19.6.0

myProject Node version

niioka-kenshiro:myProjectDir niioka-kenshiro$ node --version
v10.14.1

_Originally posted by @KenshiroNiioka in https://github.com/microsoft/vscode-js-debug/issues/543#issuecomment-762169069_

It looks like you have a copy of Node.js installed in ./node_modules/.bin/node -- and since you're running with npm, we fall back and see Node there.

I recommend either:

  • Uninstalling the copy of Node.js from your node_modules if it's not actually the version of node you want to run with
  • Configure npm to use the copy of Node.js present in your node_modules (e.g. install npm locally as well and invoke that)
  • Manually set nodeVersionHint: 10 to indicate you're running with the old version of Node.js

thanks for your reply.

It looks like you have a copy of Node.js installed in ./node_modules/.bin/node

I have not installed Node.js there.
Looking at the output logs, it looks like the nodenv binary is being used.
Does that mean I need to change the Node.js version of VSCode?

niioka-kenshiro:myProjectDir niioka-kenshiro$ ls -la ./node_modules/.bin/ | grep node.*
lrwxr-xr-x    1 niioka-kenshiro  xxxxx     25 Jan 18 18:56 nodemon -> ../nodemon/bin/nodemon.js
lrwxr-xr-x    1 niioka-kenshiro  xxxxx     25 Jan 18 18:56 nodetouch -> ../touch/bin/nodetouch.js
niioka-kenshiro:myProjectDir niioka-kenshiro$
niioka-kenshiro:myProjectDir niioka-kenshiro$ which node
/Users/niioka-kenshiro/.anyenv/envs/nodenv/shims/node
niioka-kenshiro:myProjectDir niioka-kenshiro$ 

@KenshiroNiioka please file an issue and collect logs using the instructions in the issue template

Though I'm just guessing there's bad interaction with anyenv. The latter instructions I gave to Michael is a temporary workaround however.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Skuriles picture Skuriles  路  5Comments

geirsagberg picture geirsagberg  路  5Comments

ArzelaAscoIi picture ArzelaAscoIi  路  5Comments

jtsom picture jtsom  路  8Comments

eamodio picture eamodio  路  5Comments