【问题标题】:When I run Grunt, I receive the following message: Local npm module "grunt-contrib-copy" not found. Is it installed?当我运行 Grunt 时,我收到以下消息:找不到本地 npm 模块“grunt-contrib-copy”。安装了吗?
【发布时间】:2015-10-09 01:58:27
【问题描述】:

我一直在尝试安装 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”。解决问题;它没有用。任何人都可以帮忙吗?谢谢。

【问题讨论】:

  • 有 package.json 文件吗?是否有 node_modules 文件夹?
  • 你能展示你的 Gruntfile.js 和 package.json 吗?

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


【解决方案1】:

就我而言, node_modules 位于 gruntFile.js 的父目录中
奇怪的,可能会有所帮助

【讨论】:

    【解决方案2】:

    运行 grunt 需要一个 package.json 和 Gruntfile.js 文件。将文件 package.json 和 Gruntfile 保存在项目的根目录中。之后,它会工作。

    错误:

    在根目录下保留文件package.json和Gruntfile:

    【讨论】:

      【解决方案3】:

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

      【讨论】:

      • 这是我的 Gruntfile.js:
      • 有node_modules文件夹、Gruntfile.js、package.json。我不允许输入 Gruntfile.js 和 package.json 的代码,因为代码太多。我应该安装哪些模块?它们是被称为“复制”还是“丑化”?例如,在 package.json 中,我看到了
      • 尝试npm install grunt-contrib-copy --save-dev 并告诉我错误消息是否已更改。
      • 我可以安装所有这些。当我运行 grunt 时,我收到文件错误:'. .未找到 /vendor/bootstrap/less/mixins.less'。我有一些关于修复此错误的信息,所以我会尝试一下。
      • 有一种情况是你上次'npm install'失败,所以有些模块没有安装成功,但是npm认为他们安装成功了。如果您有正确的 package.json 文件,您可以尝试删除整个 node_modules 文件夹并运行“npm install”以重新安装所有模块。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-05
      • 2013-11-23
      • 1970-01-01
      • 2014-11-18
      • 2016-03-08
      • 1970-01-01
      相关资源
      最近更新 更多