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

Not using correct node version #252

Open
zachfey opened this issue Apr 2, 2024 · 1 comment
Open

Not using correct node version #252

zachfey opened this issue Apr 2, 2024 · 1 comment

Comments

@zachfey
Copy link

zachfey commented Apr 2, 2024

I've updated from Node v16 to Node v20 and I cannot get Mocha Test Explorer to use the proper version of node. When opening the explorer, I get the following error:

Error: The module '/home/zach/dev/phalanx/nodejs/cmd/phalanx/node_modules/pg-query-native/build/Release/pg-query.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 115. This version of Node.js requires
NODE_MODULE_VERSION 108. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1340:18)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Function.Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at bindings (/home/zach/dev/phalanx/nodejs/cmd/phalanx/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/home/zach/dev/phalanx/nodejs/cmd/phalanx/node_modules/pg-query-native/index.js:1:34)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Object.require.extensions.<computed> [as .js] (/home/zach/dev/phalanx/nodejs/cmd/phalanx/node_modules/ts-node/src/index.ts:1608:43) {
  code: 'ERR_DLOPEN_FAILED'
}

I believe it is because the test explorer is running with Node v16 (which was shipped with my version of VS Code), whereas my app is now compiled with Node v20.

I've tried ensuring NVM's node path is exported in my path with export NODE_PATH='which node' and attempted pointing MocaTestExplorer to it by adding "mochaExplorer.nodePath": "$HOME/.nvm/versions/node/v20.11.1/bin/node", in settings.json, but I keep getting the same error message.

@hbenl
Copy link
Owner

hbenl commented Apr 7, 2024

attempted pointing MocaTestExplorer to it by adding "mochaExplorer.nodePath": "$HOME/.nvm/versions/node/v20.11.1/bin/node", in settings.json

That should have fixed it. You could try turning on diagnostic logging, it should contain a message "[DEBUG] Using nodePath: ..." showing which path it uses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants