Skip to content

Instantly share code, notes, and snippets.

@mbinic
Last active February 24, 2022 09:21
Show Gist options
  • Save mbinic/f2a97e7fcb3e2233e02ea03f5bcbb1f8 to your computer and use it in GitHub Desktop.
Save mbinic/f2a97e7fcb3e2233e02ea03f5bcbb1f8 to your computer and use it in GitHub Desktop.
Help WebStorm run the correct version of npm when using Volta
// Place inside C:\Program Files\Volta\bin and set WebStorm's Package Manager to C:\Program Files\Volta
// Credit: Modified from nodist - https://github.com/nullivex/nodist/blob/master/npm/bin/npm-cli.js
var child_process = require('child_process');
child_process.spawn('npm', process.argv.slice(2), {stdio: 'inherit'})
.on('error', function(err) {
console.log('Sorry. There was a problem with indirect running of npm.');
throw err;
})
.on('exit', function(code) {
if (code) {
process.exit(code);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment