Rerunning dlx command on different node version doesnt use different modules
Verify latest release
- [x] I verified that the issue exists in the latest pnpm release
pnpm version
9.12.0
Which area(s) of pnpm are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
No response
Reproduction steps
Set default node to 21
> pnpm dlx renovate --platform=local
Downloading [email protected]: 5.42 MB/5.42 MB, done
WARN 3 deprecated subdependencies found: [email protected], [email protected], [email protected]
Packages: +773
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 773, reused 541, downloaded 232, added 773, done
.cache/pnpm/dlx/cywey2pircc73svwjusktx4fzq/1925a05254a-29dac9/node_modules/.pnpm/[email protected]/node_modules/dtrace-provider: Running install script, done in 8.8s
.cache/pnpm/dlx/cywey2pircc73svwjusktx4fzq/1925a05254a-29dac9/node_modules/.pnpm/[email protected]/node_modules/protobufjs: Running postinstall script, done in 40ms
.cache/pnpm/dlx/cywey2pircc73svwjusktx4fzq/1925a05254a-29dac9/node_modules/.pnpm/[email protected]/node_modules/re2: Running install script, done in 18.7s
.cache/pnpm/dlx/cywey2pircc73svwjusktx4fzq/1925a05254a-29dac9/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3: Running install script, done in 1m 6.1s
(node:2746925) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node21 --trace-deprecation ...` to show where the warning was created)
Then change node to 18
> pnpm dlx renovate --platform=local
WARN: RE2 not usable, falling back to RegExp
"err": {
"code": "ERR_DLOPEN_FAILED",
"message": "The module '/home/jayvdb/.cache/pnpm/dlx/cywey2pircc73svwjusktx4fzq/1925a05254a-29dac9/node_modules/.pnpm/[email protected]/node_modules/re2/build/Release/re2.node'\nwas compiled against a different Node.js version using\nNODE_MODULE_VERSION 120. This version of Node.js requires\nNODE_MODULE_VERSION 108. Please try re-compiling or re-installing\nthe module (for instance, using `npm rebuild` or `npm install`).",
"stack": "Error: The module '/home/jayvdb/.cache/pnpm/dlx/cywey2pircc73svwjusktx4fzq/1925a05254a-29dac9/node_modules/.pnpm/[email protected]/node_modules/re2/build/Release/re2.node'\nwas compiled against a different Node.js version using\nNODE_MODULE_VERSION 120. This version of Node.js requires\nNODE_MODULE_VERSION 108. Please try re-compiling or re-installing\nthe module (for instance, using `npm rebuild` or `npm install`).\n at Object.Module._extensions..node (node:internal/modules/cjs/loader:1460:18)\n at Module.load (node:internal/modules/cjs/loader:1203:32)\n at Function.Module._load (node:internal/modules/cjs/loader:1019:12)\n at Module.require (node:internal/modules/cjs/loader:1231:19)\n at require (node:internal/modules/helpers:177:18)\n at Object.<anonymous> (/home/jayvdb/.cache/pnpm/dlx/cywey2pircc73svwjusktx4fzq/1925a05254a-29dac9/node_modules/.pnpm/[email protected]/node_modules/re2/re2.js:3:13)\n at Module._compile (node:internal/modules/cjs/loader:1364:14)\n at Object.Module._extensions..js (node:internal/modules/cjs/loader:1422:10)\n at Module.load (node:internal/modules/cjs/loader:1203:32)\n at Function.Module._load (node:internal/modules/cjs/loader:1019:12)"
}
Describe the Bug
There are two problems I have.
The main one is that pnpm is selecting a built version of re2 that was built with an incompatible version of node.
Then, I thought how do I remove the cached dlx-installed "renovate" so that it can start again?
It seems like this would be solved by something like pnpm dlx ---reinstall , but there isnt any option for that in https://pnpm.io/cli/dlx
Ok, can I manually remove it? But the CLI doesnt show me where it is
> pnpm list --global --json renovate
[
{
"path": "/home/jayvdb/.local/share/pnpm/global/5",
"private": false
}
]
Expected Behavior
pnpm dlx should resolve to node version specific built packages.
pnpm dlx should have an option to allow reinstalling/removing an existing package.
pnpm should have a way to show where a dlx installed package starts at to allow manual deletion.
Which Node.js version are you using?
18 and 21
Which operating systems have you used?
- [ ] macOS
- [ ] Windows
- [X] Linux
If your OS is a Linux based, which one it is? (Include the version if relevant)
openSUSE
We can add the system node.js version to the cache key. To get the system node.js we can use this code: https://github.com/pnpm/pnpm/blob/main/config/package-is-installable/src/getSystemNodeVersion.ts
However, I don't remember if dlx supports the use-node-version setting currently. If it does, that is the node version that should be included in the cache key.