当我运行Grunt时,我收到以下消息:找不到本地npm模块“grunt-contrib-copy”。它安装了吗?

时间:2015-07-20 02:39:34

标签: node.js npm grunt-contrib-watch grunt-contrib-uglify grunt-contrib-copy

我一直在尝试安装Grunt。当我运行grunt时,我会收到以下消息和警告列表:

Local Npm module "grunt-contrib-copy" not found.  Is it installed?
Local Npm module "grunt-contrib-uglify" not found.  Is it installed?
Local Npm module "grunt-contrib-jshint" not found.  Is it installed?
Local Npm module "grunt-contrib-less" not found.  Is it installed?
Local Npm module "grunt-contrib-clean" not found.  Is it installed?
Local Npm module "grunt-contrib-watch" not found.  Is it installed?
Local Npm module "grunt-contrib-concurrent" not found.  Is it installed?
Local Npm module "grunt-contrib-nodemon" not found.  Is it installed?
Local Npm module "grunt-contrib-newer" not found.  Is it installed?
Warning: Task "copy:vendor" not found. Use --force to continue.
Aborted due to warnings.

我尝试过“npm install”,“npm install grunt --save-dev”,“grunt init:node”。解决问题;它不起作用。有人可以帮忙吗?感谢。

3 个答案:

答案 0 :(得分:10)

您似乎没有在Gruntfile.js中加载模块,或者您还没有安装所有模块。对所有模块尝试npm install <module-name> --save-dev

答案 1 :(得分:0)

运行grunt需要package.json和Gruntfile.js文件。将文件package.json和Gruntfile保留在项目的根目录中。之后,它将起作用。

错误:

enter image description here

将文件package.json和Gruntfile保留在根目录之后:

enter image description here

答案 2 :(得分:0)

就我而言, node_modulesgruntFile.js的父目录中
奇怪的一个,可能会有所帮助