咕error错误:找不到模块“咕gr" [英] Grunt error: Cannot find module 'time-grunt'

查看:59
本文介绍了咕error错误:找不到模块“咕gr"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试安装本地和全局的时间限制,清除npm缓存,更新npm,但是没有任何帮助.我得到:

I try to install time-grunt local and global, clear npm cache, update npm, but nothing helps. I get:

 Loading "Gruntfile.js" tasks...ERROR
 Error: Cannot find module 'time-grunt'
 Warning: Task "default" not found. Use --force to continue.

我的软件包版本:节点:"0.10.31",npm:"1.4.23"

My version of packages: node: '0.10.31', npm: '1.4.23'

运行后:npm install --save-dev时间限制在package.json状态:

After run: npm install --save-dev time-grunt in package.json state:

"devDependencies": {
"grunt": "^0.4.5",
...
"time-grunt": "^1.0.0"
}

这是我的grunfile.js的一部分:

This is part of my grunfile.js:

module.exports = function( grunt ) {
     require('time-grunt')(grunt);
 
     grunt.initConfig({
     // grunt tasks here
     });
     // load tasks here
     // register task here
}

其他运行正常的任务而没有错误.

Other grunt tasks running without error.

我不明白怎么了.

如何通过CLI正确测试time-grunt的安装?

How I can test correctly installation of time-grunt by CLI?

推荐答案

您需要将其添加到依赖项中,而不是devDependencies中.这样,您无需单独运行 $ npm install --save-dev time-grunt

You need to add it inside dependencies and not within devDependencies. This way you don't need to separately run $ npm install --save-dev time-grunt

{
  "name": "grunt-build",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "time-grunt": "^1.3.0"
  },
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-contrib-clean": "~0.7.0",
    "grunt-contrib-compress": "~0.5.0",
    "grunt-contrib-concat": "~0.5.0",
    "grunt-contrib-copy": "^0.8.0",
    "grunt-contrib-uglify": "~0.5.0",
    "grunt-remove-logging": "~0.2.0"
  }
}

这篇关于咕error错误:找不到模块“咕gr"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆