Last active
February 24, 2022 09:21
-
-
Save mbinic/f2a97e7fcb3e2233e02ea03f5bcbb1f8 to your computer and use it in GitHub Desktop.
Help WebStorm run the correct version of npm when using Volta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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