devbox icon indicating copy to clipboard operation
devbox copied to clipboard

nodejs packages comes preinstalled with npm but we can't update the npm version

Open zeachco opened this issue 4 months ago • 0 comments

What problem are you trying to solve?

npm is shipped separately to allow to update npm independently but devbox seems to couple that with npm being locked with the node version selected. I didn't find a documentation on how to run nodejs@22 with [email protected] for example

running npm install --global npm fails as nix stores are immutable

Additional context on why not just using the npm version that comes with the selected node version: package.lock differ with different npm version and it's hard to adapt devbox with other systems that don't use devbox, we would also like to use the latest npm versions given they have speed and space optimisations

What solution would you like?

would it be possible to use the

devbox add [email protected] like for other global node depependencies?

Alternatives you've considered

A work around I found is to add in devbox.json "init_hook": ["npm() { command npx -y [email protected] \"$@\"; }"] but that's slower, hacky and too fragile to my taste

zeachco avatar Aug 25 '25 15:08 zeachco