无法运行grunt命令

3
所有的npm安装都出现了错误和警告,但最终显示“一切正常”。 当我尝试使用grunt serve时,我收到了这些警告。
>> Local Npm module "grunt-contrib-connect" not found. Is it installed?
>> Local Npm module "grunt-contrib-watch" not found. Is it installed?
>> Local Npm module "grunt-contrib-htmlmin" not found. Is it installed?
>> Local Npm module "grunt-contrib-cssmin" not found. Is it installed?
>> Local Npm module "grunt-contrib-uglify" not found. Is it installed?
>> Local Npm module "grunt-bower-requirejs" not found. Is it installed?
>> Local Npm module "grunt-eslint" not found. Is it installed?
>> Local Npm module "grunt-jscs" not found. Is it installed?

如何解决这个问题?

所有的npm安装都出现了错误 - 这可能是Grunt警告的部分原因。 - user123444555621
2个回答

6

您是在Mac还是Windows上安装?首先,请确认Grunt客户端已经安装在您的目录中:

$ npm install -g grunt-cli

然后:

$ npm install grunt-serve

在此处可以找到更多有关安装的文档: https://www.npmjs.org/package/grunt-serve


1

Try as below:

 1) npm install -g grunt-cli

这将把grunt命令放在您的系统路径中,允许从任何目录运行。

请注意,安装grunt-cli不会安装Grunt任务运行器! Grunt CLI的工作很简单:运行与Gruntfile旁边安装的Grunt版本。这样可以同时在同一台机器上安装多个版本的Grunt。

 2) npm install grunt --save-dev 

 3) npm install grunt-serve

使用命令npm install --save-dev,可以最简单地将Grunt和grunt插件添加到现有的package.json中。这不仅会在本地安装,而且还会自动添加到devDependencies部分,使用波浪线版本范围。
如需进一步帮助,请访问此链接。

http://gruntjs.com/getting-started


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接