Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
193 views
in Technique[技术] by (71.8m points)

macos - Why does Grunt not add itself to the shell?

I have a problem installing grunt. All the documentation, and blog post tutorials, say that running:

npm install -g grunt

will then allow you to run grunt commands from the terminal.

I have a situation where grunt appears to install with no errors, but typing the command grunt in the terminal still gives:

-bash: grunt: command not found

What could I be doing wrong? And where could I find grunt to add it to my BASH profile manually?

question from:https://stackoverflow.com/questions/12534424/why-does-grunt-not-add-itself-to-the-shell

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Since Grunt version 0.4 (which was released 1 or 2 weeks ago) you need to install the grunt command line tool globally (if needed, use sudo before the command):

npm install -g grunt-cli

In your project location you then install the latest grunt version:

npm install grunt --save-dev

Option --save-dev will save the npm config in your package.json file, which makes it easier to install or reinstall the dependencies (using just npm install).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...