Skip to content

Instantly share code, notes, and snippets.

@jareware
Created July 30, 2014 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jareware/e58c3dee23b7cb32e652 to your computer and use it in GitHub Desktop.
Save jareware/e58c3dee23b7cb32e652 to your computer and use it in GitHub Desktop.
Getting the Grunt plugin to work on an IntelliJ IDE with nvm

IntelliJ Grunt plugin with nvm

This is a relatively hacky solution, but simplest one that works, so writing it down for my own reference. If the Grunt plugin was aware of nvm (or configurable to use a custom environment before launching the "grunt" command) this would be a LOT easier, but if such config options exist I'm unaware of them. Also note that this will NOT switch your node version dynamically between projects as nvm would.

To link your current node as the global one:

$ sudo ln -s $(which node) /usr/bin/node
$ sudo ln -s $(which npm) /usr/bin/npm

Then you'll need a global grunt-cli so that the Grunt plugin can find it, and any gems your build process may use (mine needs compass, and the Grunt plugin is no more aware of rvm than nvm). Make sure you're in a terminal where you're using the aforementioned global npm and global ruby (confirm with which npm etc):

$ sudo npm install -g grunt-cli
$ sudo gem install compass --version 0.12.2

The same restrictions apply (that is, no automatic switching between projects) for both grunt-cli and compass.

Sidenote on Terminal

IDEA et al also contain a Terminal tab, which is a handy way to drop back into the CLI when the git or grunt integrations don't cut it. In that terminal you CAN use nvm and nvm as usual, but at least I had to go and set:

Preferences -> Terminal -> Shell path

to

/usr/local/bin/bash --rcfile ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment