vit*_*-ne 15 node.js npm gruntjs
我尝试安装time-grunt本地和全局,清除npm缓存,更新npm,但没有任何帮助.我明白了:
Loading "Gruntfile.js" tasks...ERROR
Error: Cannot find module 'time-grunt'
Warning: Task "default" not found. Use --force to continue.
Run Code Online (Sandbox Code Playgroud)
我的版本od包:节点:'0.10.31',npm:'1.4.23'
运行后:npm install --save-dev time-grunt in package.json state:
"devDependencies": {
"grunt": "^0.4.5",
...
"time-grunt": "^1.0.0"
}
Run Code Online (Sandbox Code Playgroud)
这是我的grunfile.js的一部分:
module.exports = function( grunt ) {
require('time-grunt')(grunt);
grunt.initConfig({
// grunt tasks here
});
// load tasks here
// register task here
}
Run Code Online (Sandbox Code Playgroud)
其他grunt任务运行没有错误.
我不明白有什么不对.
我如何通过命令行正确测试time-grunt的安装?
Shi*_*yaz 14
您需要将其添加到依赖项中,而不是在devDependencies中.这样您就不需要单独运行了$ 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"
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
28373 次 |
| 最近记录: |