zsh: command not found: grunt-init

2.8k Views Asked by At

I'm new to gruntjs and am trying to get the grunt-init templates up and running however I constantly get this error: zsh: command not found: grunt-init

when I run the install it shows me all of this, so it seems like it is installing fine

→ npm install -g grunt-init
/Users/jsturgess/npm-global/bin/grunt-init -> /Users/jsturgess/npm-global/lib/node_modules/grunt-init/bin/grunt-init
[email protected] /Users/jsturgess/npm-global/lib/node_modules/grunt-init
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

I've followed the grunt-init install directions and made the ~/.grunt-init/ directory and cloned the jquery template via the command the gave

git clone https://github.com/gruntjs/grunt-init-jquery.git ~/.grunt-init/jquery

What do I need to do to be able to use the grunt-init command?

2

There are 2 best solutions below

0
JSturgessMeyers On BEST ANSWER

Fixed this problem by undoing the npm permission changes I had done from this article: https://docs.npmjs.com/getting-started/fixing-npm-permissions

14
sandeep s On

Seems like you are using OhMyZsh. You need to add the Grunt files to your $PATH variable.

cd into your home directory and find this file .zshrc and look for the line with

export PATH=

and modify it like:

export PATH="path_to_grunt:$PATH"

the ':' serves as a delimiter for multiple paths.

What you are probably looking for is here:

export PATH="/usr/local/lib/node_modules/grunt-cli/bin/grunt:$PATH"