Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How does one install grunt on Ubuntu 13.04?

I've attempted to install it via NPM:

sudo npm install -g grunt

Then when i run grunt:

grunt

But it doesn't seem to work it throws an error:

path.js:313
        throw new TypeError('Arguments to path.resolve must be strings');
              ^ TypeError: Arguments to path.resolve must be strings
    at Object.exports.resolve (path.js:313:15)
    at Object.<anonymous> (/usr/local/lib/node_modules/grunt/bin/grunt:13:16)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:901:3

Here's some information about what version of node i have:

$ npm -v                                                                      
1.3.8
share|improve this question
    
Did you really mean to run the command sudo npm install -g grunt $ grunt? Shouldn't sudo npm install -g grunt be sufficient? I think the $ isn't valid syntax for the npm install command. –  gertvdijk Aug 27 '13 at 16:28
    
I'm illustrating the prompt. Sorry no $ needed. Also, was that the reason why you downvoted? Sorry i can change that if you'd like. –  chrisjlee Aug 27 '13 at 19:36
    
Related: stackoverflow.com/questions/18250437/… –  chrisjlee Oct 18 '13 at 15:08
    
You should avoid using sudo with npm! –  nicholaschris Aug 15 at 10:19

3 Answers 3

I believe you want: npm install -g grunt-cli which installs the command line tool. You install grunt (and modules) locally in each project

Docs here to back up my words; http://gruntjs.com/getting-started

share|improve this answer

I just installed grunt from PPA. Here is a full list of steps that I had to take to get a working grunt build:

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update 
sudo apt-get install nodejs
# remove a conflicting install of npm that I had tried earlier
sudo apt-get update && sudo apt-get -y dist-upgrade
sudo npm install -g grunt grunt-cli grunt-contrib-clean grunt-replace grunt-contrib-concat grunt-contrib-watch grunt-contrib-jasmine grunt-contrib-connect grunt-saucelabs grunt-gitinfo
share|improve this answer
    
Thanks. Worked like charm –  karlingen Aug 18 at 8:39
up vote 2 down vote accepted

Looks like the error occurs when there are two versions of grunt.

To find out if you have two versions of grunt installed you run in CLI:

where grunt or which grunt

If you see more than one version of grunt:

/usr/local/bin/grunt
/usr/bin/grunt
/usr/local/bin/grunt
/usr/bin/grunt

Then you just remove one of them:

rm /usr/local/bin/grunt

Wrote a post on this for more information.

share|improve this answer
1  
I don't seem to have that where command available. –  tutuca Aug 22 at 1:32
1  
@tutuca you can use which grunt instead –  Kim Stacks Sep 10 at 20:44
    
oh, I know... but where was interesting :P –  tutuca Sep 11 at 13:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.