![](/img/trans.png)
[英]grunt-loop-mocha: Warning: Task “loopmocha” not found. Use --force to continue
[英]Grunt - Warning: Task “default” not found. Use --force to continue
刚开始尝试设置 Grunt,但立即遇到了问题。
Warning: Task "default" not found. Use --force to continue.
或全文:
>> Error: Unable to parse "package.json" file (Unexpected token c).
Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.
我正在遵循本指南: http : //24ways.org/2013/grunt-is-not-weird-and-hard/
这两个文件是:
包.json:
{
"name": "BuildSanctuary",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-concat": "^0.5.0"
}
}
Gruntfile.js
module.exports = function(grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
dist: {
src: [
'public_html/js/*.js', // All JS in the libs folder
],
dest: 'public_html/js/production.js',
}
}
});
// 3. Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-concat');
// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask('default', ['concat']);
};
为了解决这个问题,我将文件保存为 UTF-8 并且运行良好。
以 UTF-8 格式保存文件会有所帮助。 在我的情况下,只需转到文本编辑器它的崇高文本即可。
文件 -> 使用编码保存 -> UTF-8
grunt 能够找到默认任务。
我能够通过安装 grunt-cli 来解决这个问题,我只安装了 grunt 并且遇到了同样的错误。
npm install --save-dev grunt-cli
编辑:以上只是让我更接近问题。 我遇到了其他丢失的软件包。 一旦我把它们都安装好了,它就起作用了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.