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

Bri*_*ian 6 node.js npm grunt-contrib-watch grunt-contrib-copy grunt-contrib-uglify

我一直在尝试安装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.
Run Code Online (Sandbox Code Playgroud)

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

VDa*_*cau 11

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

  • 有一种情况是您的上一次"npm安装"失败,因此某些模块未成功安装,但是npm认为它们已成功安装.如果你有正确的package.json文件,你可以尝试删除整个node_modules文件夹并运行'npm install'来重新安装所有模块. (2认同)