How to set location of global NPM modules in WebStorm?

I use Ubuntu and install Node.js via APT. The global modules go into /usr when installed this way. As per the official NPM website, I correct my command line global module permissions using one of their recommended methods:

https://docs.npmjs.com/getting-started/fixing-npm-permissions

Because my modules go into /usr, I opt for option #2, where I choose a different spot to store the global modules, where I do have permission. This fixes the command line "npm install -g" but breaks WebStorm's ability to see them. During the New Project dialog, I can't use create-react-app or express for example.

I looked for an area in Settings to set my new global module location but I couldn't find one.

7 comments

No way currently. There is a feature request to check npm prefix when searching for global modules, please vote for it: https://youtrack.jetbrains.com/issue/WEB-22230 for updates.

But still it should be possible to specify a path to your global create-react-app module when creating a project - doesn't it work fr you?

0

It sounds like that feature request is exactly what I was looking for. I should make a correction: Through the New Project dialog, express still works, just not create-react-app.

Unfortunately, manually specifying the path to my global create-react-app module does not work:

So it seems this negatively affects me more than I thought it would. Luckily, my current workaround is to just use create-react-app via the terminal to create my app, then open it with WebStorm.

0

>Unfortunately, manually specifying the path to my global create-react-app module does not work:

 

please can you recreate the issue and provide your idea.log (https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files)? You can put it on a file server and provide a link

0

I made sure the last thing I did was attempt to create the project and then close the IDE, and this is what my log file looks like after:

https://drive.google.com/open?id=0B0CzIvFgpDlLNFBUZG8xTEhNb28

0

does the problem persist if you run WebStorm from your system terminal?

0

I don't know how to run WebStorm from the system terminal. I used to install the IDEs by extracting from the tar.gz and running the <ide>.sh scripts, but now I use the Toolbox. I explored the ~/.WebStorm folder but I couldn't find any executable to start it.

0

try searching for webstorm.sh in your home dir - it may be smth like `~/.local/share/JetBrains/Toolbox/apps/WebStorm/ch-0/163.12024.17/bin/webstorm.sh`. If WebStorm was started via Toolbox'а, you can use `ps aux | grep webstorm.sh` command to locate the launcher

0

Please sign in to leave a comment.