简体   繁体   English

Grunt服务器:在终端中找不到命令

[英]Grunt server: command not found in terminal

In my project directory, I installed Grunt by using the following command: 在我的项目目录中,我使用以下命令安装了Grunt:

npm install grunt

...after that I did Grunt server in my project directory but it gives me command not found error. ...之后,我在项目目录中做了Grunt服务器,但是它给了我命令未找到的错误。

Raj$ grunt server
-bash: grunt: command not found

And: 和:

npm install grunt
npm WARN package.json BID-2.0@0.0.0 No description
npm WARN package.json BID-2.0@0.0.0 No repository field.
npm WARN package.json BID-2.0@0.0.0 No README data

How can I fix it? 我该如何解决?

You need to install Grunt 's command line interface (CLI) globally as well. 您还需要全局安装Grunt的命令行界面(CLI)。

From their site: 从他们的网站:

npm install -g grunt-cli

You may need to use sudo command (for OSX, *nix, BSD etc) or run your command shell as Administrator (for Windows) to do this. 您可能需要使用sudo命令(对于OSX,* nix,BSD等)或以管理员身份运行命令Shell(对于Windows)来执行此操作。

This will put the grunt command in your system path, allowing it to be run from any directory. 这会将grunt命令放在您的系统路径中,从而可以从任何目录运行它。

You will have to install grunt after installing node / npm with: npm install -g grunt . 使用以下命令安装node / npm后,必须安装grunt: npm install -g grunt Then it will be available at the cmd. 然后它将在cmd上可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM