[英]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.