我尝试安装 time-grunt 本地和全局、清除 npm 缓存、更新 npm,但没有任何帮助。
我得到:
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'
运行后:
npm install --save-dev 时间-grunt
在 package.json 状态:
"devDependencies": {
"grunt": "^0.4.5",
...
"time-grunt": "^1.0.0"
}
这是我的 grunfile.js 的一部分:
module.exports = function( grunt ) {
require('time-grunt')(grunt);
grunt.initConfig({
// grunt tasks here
});
// load tasks here
// register task here
}
其他 grunt 任务运行没有错误。
我不明白出了什么问题。
如何通过 CLI 正确测试 time-grunt 安装?
您需要将其添加到依赖项中,而不是添加到 devDependency 中。这样就不需要单独运行$ 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"
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)