Search code examples
node.jsgruntjsghost-blog

Installing Grunt, osx, nvm, zsh


Installing Grunt

I have osx yosemite, zsh, nvm. The version of node I am using is v0.10.33.

I installed node in a way I do not need to use sudo (node and npm reside in my home folder)

here where I export the global dependencies in my zshrc

export NODE_PATH=/Users/nickname/.node/lib/node_modules/:/Users/nickname/.node/lib/node_modules

Just for information, I am trying to install Ghost (the blogging plataform).

I cloned like this to get the stable version

git clone -b stable https://github.com/TryGhost/Ghost.git ghost

and then

cd ghost/
git submodule update --init
npm install -g grunt-cli
npm install
grunt init

The error I am getting is that is not able to find grunt

Ghost git:(stable) grunt init zsh: command not found: grunt


Solution

  • You're not supposed to install grunt globally, only grunt-cli. The grunt package should be installed in your project directory using something like:

    ~$ npm install grunt --save-dev
    

    That will add a line to your project's package.json file, then you configure a "Gruntfile.js" for your project with tasks that are run from the command line with:

    ~$ grunt taskname