How to change which terminal built in WebStorm tools use (npm)

I am using Windows 10 and use Bash for windows. I have successfully set up Bash to be my built in terminal in WebStorm (2018.1). In the built in terminal, for my React project, I ran npm install. Everything works fine. I can then run npm start, (which starts the development); again everything works fine. Now, if I click on the NPM tool from inside Webstorm, and click start there (thus using WebStorm to run my npm script instead of me typing it in the built in terminal) I get an error. It says: 

Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 6.x

Found bindings for the following environments:
- Linux 64-bit with Node.js 6.x

I get the same message if I try and run npm start from a normal windows cmd.exe prompt. 

So what it boils down to is this: Is there a way to change what terminal the built in WebStorm tools use (in this case npm)? (I would have thought setting the built in terminal to Bash would have done the trick :( )

For reference I did look at the settings for running npm scripts in webstorm. The correct path to npm in there and that is proven by the fact that the script does in fact attempt to run. What it is failing at is the fact that the npm dependencies were installed with Bash for windows, and therefor "npm start" must run from the Bash for windows, not cmd.exe.

Also tried to start webstorm from Bash.exe but that changed nothing.

1 comment
Comment actions Permalink

>So what it boils down to is this: Is there a way to change what terminal the built in WebStorm tools use (in this case npm)?

WebStorm doesn't use any shells to run npm - it runs Node.js directly. And it's not possible to use Node interpreter from WSL to run npm from webStorm - please see https://youtrack.jetbrains.com/issue/WEB-22794

You have to re-build node-sass for Node.js you have installed on Windows if you like to run your scripts from WebStorm

0

Please sign in to leave a comment.