13
votes

I've tried to run Grunt.js before I compile and launch my project without any luck.

I've tried to run it with the "Run External Tool" option in IntelliJ configuration edition menu, it asks you for the path of the program you want to run, I've tried to add the Grunt path in /usr/bin but it tells me that the node environment cannot be found.

4

4 Answers

9
votes

This answer helped me more than what you selected as the correct answer. The difference is that this one is for webstorm. Here's what I'd do: I'd install the node.js plugin in intellij, then configure it like this:

  • Path to Node: C:\Program Files\nodejs\node.exe
  • Working Directory: directory with your Gruntfile.js in it
  • Path to Node App JS File: C:\Users\yourusername\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt
  • Application Parameters: Whatever you want to pass to grunt as parameters

This is on windows 7.

8
votes

Installed Node.js via Homebrew on OSX, grunt via npm. After fiddling around, it now works with following in IntelliJ Ultimate 12:

Edit Configurations -> Add new configuration -> Node.js

In the Run/Debug Configurations window:

  • Path to Node: /usr/local/bin/node
  • Node Parameters: empty
  • Working Directory: _directory_of_gruntfile_
  • Path to Node App JS File: /usr/local/bin/grunt
5
votes

Configuration that works for me (I'm on Windows 7):

Program: C:\Program Files\nodejs\node.exe

Parameters: ~\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt

Working directory:$ProjectFileDir$

1
votes

On Mac GUI applications get their environment variables from /etc/launchd.conf. Because of this the "terminal" in IntelliJ doesn't know about Node or Grunt because it doesn't know where to look for them. If you add your PATH environment variable to /etc/launchd.conf and restart your computer IntelliJ will be able to run Grunt as part of the server deployment.

The easiest way to get this in there is to do:

echo $PATH | pbcopy

and then in /etc/launchd.conf put in:

setenv PATH pasteResultsFromTheClipboardHere

Note: you have to edit launchd.conf as sudo or it won't let you write the file. Your path variable should contain the locations where node and grunt are installed.