Search code examples
intellij-ideanpmnvm

npm is installed using nvm but IntelliJ does not know about it


I installed NPM using NVM.

When I use npm in Intellij terminal, it says I don't have NPM installed. But if I use Ubuntu terminal, it is working.

Here are what I tried:

I have already tried to set my node interpreter (in "Language and Framework" > "Node and NPM", set to ~/.nvm/versions/node/v6.8.0/bin/node).

I have also already enabled the Node.js Core library. There it shows the npm package is included.

But the IntelliJ terminal still complains I haven't installed npm. Why?


Solution

  • It is because idea terminal launches a login shell by default, so the .bashrc file is not read.

    To solve the problem:

    Open "Settings" in IntelliJ. Then, expand "Tools" in the left panel, then click 'Terminal'.

    Add -i to the Shell Path. (eg. /bin/bash -i)