Node.js   发布时间:2022-04-24  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了node.js – 错误:找不到模块’time-grunt’大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我尝试安装time-grunt本地和全球,清除npm缓存,更新npm,但没有任何帮助.
我得到:

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

我的版本od包:
节点:’0.10.31′,
npm:’1.4.23′

运行后:
npm安装–save-dev时间gr.
在package.json状态:

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

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

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

其他grunt任务运行没有错误.

我不明白有什么问题

如何通过命令行正确测试安装时间?

解决方法

您需要将它添加到依赖关系中,而不是在依赖关系内.这样你不需要单独运行$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"
  }
}

大佬总结

以上是大佬教程为你收集整理的node.js – 错误:找不到模块’time-grunt’全部内容,希望文章能够帮你解决node.js – 错误:找不到模块’time-grunt’所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。