错误:无法找到模块'时间咕噜' [英] Error: Cannot find module 'time-grunt'
问题描述
我尝试安装time-grunt本地和全局,清除npm缓存,更新npm,但没有任何帮助。
我得到:
pre $ 加载Gruntfile.js任务...错误
错误:无法找到模块'时间咕噜'
警告:找不到任务默认。使用--force继续。
我的od软件包版本:
node:'0.10.31',
npm:'1.4.23'
运行后:
npm install --save-dev time-grunt $ b $ in package.json状态:
devDependencies:{
grunt:^ 0.4.5,
...
time-grunt:^ 1.0.0
}
这是我的grunfile.js的一部分:
module.exports = function(grunt){
require('time -grunt')(咕噜);
grunt.initConfig({
// grunt tasks here
});
//在这里加载任务
//在这里注册任务
}
<
我不明白什么是错的。
我该如何测试通过命令行正确安装time-grunt?
您需要将它添加到依赖关系中,而不是在devDependencies中。这样你就不需要分别运行 $ npm install --save-dev time-grunt
{
name:grunt-build,
version:0.1.0,
private:true,
依赖项:{
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
}
}
I try 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.
My version od packages: node: '0.10.31', npm: '1.4.23'
After run: npm install --save-dev time-grunt in package.json state:
"devDependencies": {
"grunt": "^0.4.5",
...
"time-grunt": "^1.0.0"
}
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 runing without error.
I not understand what is wrong.
How I can test correctly installation of time-grunt by command line?
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"
}
}
这篇关于错误:无法找到模块'时间咕噜'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!