$customHeader
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

As always installing something on Ubuntu may be a little tricker, this is how I got Node.js & Grunt to install on Ubuntu 12.04

Step-by-step guide

Within Kalastack...

  1. Run these commands in order:

    $ sudo apt-get install software-properties-common
    $ sudo apt-get install python-software-properties
    $ sudo apt-add-repository ppa:chris-lea/node.js
    $ sudo apt-get update
  2. Then use this command to get the latest version of node.js
    1. sudo apt-get install nodejs
    2. (If you have problems): John needed to designate a version; this shouldn't be necessary, but if you're having problems, try finding the latest version...
      1. sudo apt-cache showpkg nodejs
      2. ...then putting that in after the 'nodejs=' in sudo apt-get install nodejs (ex: sudo apt-get install nodejs=0.10.26-1chl1~precise1)
  3. Then continue on running:

    $ sudo npm -g install grunt
    $ sudo npm install -g grunt-cli
    $ sudo chown -R vagrant:vagrant /usr/lib/node_modules
    $ sudo chown -R vagrant:vagrant /home/vagrant/.npm
    1. if "npm --version" doesn't return something, see #3 at bottom of page.

       

  4. cd into your project folder and create a file called package.json ("touch package.json")

    1. open with your editor (sublime), put this in there:

      {
      "name": "THE PROJECT NAME",
      "version": "0.1.0",
      "devDependencies": {
      "grunt": "~0.4.4" (or whatever version is above)
      }
      }
  5. Then from the CLI again run while in your project folder

    $ npm install

YOU can also follow to tutorial here on how to use Grunt, dont really follow the install stuff except when you get to concatenating files as this was written for a MAC:

http://24ways.org/2013/grunt-is-not-weird-and-hard/

Other Weird Stuff

Some other things to watch out for:

  1. If you have a problem installing dependencies with "npm install", you may see subsequent "npm install" freeze on a step. If you see all the directories in /yourproject/node_modules are empty, deleting those directories and trying "npm install" again may help.
  2. There can be some strange permissions errors on a Vagrant environment; if you receive an error that mentions chown and asks you to "Please try running this command again as root/Administrator," make sure you're using "npm install" (these errors tend to pop up when trying "sudo npm install"). If the file in question that npm is unable to chown is something like "/home/vagrant/tmp", make sure that tmp directory belongs to the user "vagrant:vagrant" (sometimes it's owned by root:root, which will cause problems).
  3. If for some reason npm -g install grunt doesnt work run these 2 commands:
    1. sudo chown -R vagrant:vagrant /usr/lib/node_modules

    2. sudo chown -R vagrant:vagrant /home/vagrant/.npm

    3. Try npm --version again, if it still fails fails do this:
      1. Look at where you ran npm -g install grunt, this will have your Grunt Version, (looks like grunt@0.4.4), mine was:

      2. npm http GET http://registry.npmjs.org/grunt/-/grunt-0.4.4.tgz. You will have to get and unpack the  tar manually

      3. if still no luck, just do this:
        1. sudo apt-get install npm
        2. npm config set registry http://registry.npmjs.org/
        3. sudo chown -R vagrant:vagrant /usr/lib/node_modules

        4. sudo chown -R vagrant:vagrant /home/vagrant/.npm

 

  • No labels