Grunt服务器:在terminal找不到命令

在我的项目目录中,我使用下面的命令安装了Grunt:

npm install grunt 

…之后,我在我的项目目录中做了Grunt服务器,但它给了我命令找不到错误。

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

和:

 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 

我该如何解决?

您还需要全局安装Grunt的命令行界面(CLI)。

从他们的网站:

 npm install -g grunt-cli 

您可能需要使用sudo命令(对于OSX,* nix,BSD等)或以pipe理员身份运行命令shell(对于Windows)来执行此操作。

这将把grunt命令放在你的系统path中,允许它从任何目录运行。

在安装node / npm之后,您将不得不安装grunt: npm install -g grunt 。 那么它将在cmd中可用。

Interesting Posts