亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

請問,我在啟動grunt concurrent的時候遇到報錯:No "concurrent" targets found;

我之前已經用npm下載好了,并且在Gruntfile.js里使用:grunt.loadNpmTasks('grunt-concurrent');載入插件。

正在回答

5 回答

grunt.registerTask('default',['concurrent']);

你配置的最后一行應該是:

grunt.registerTask('default',['concurrent:target']);


0 回復 有任何疑惑可以回復我~

不知道你的問題有沒有解決 我也遇到了一樣的問題:

http://img1.sycdn.imooc.com//57e0da7d00018e0105390137.jpg

0 回復 有任何疑惑可以回復我~

這是完整的配置代碼:

module.exports?=?function(grunt)?{

??grunt.initConfig({
????watch:?{
??????jade:?{
????????files:?['views/**'],
????????options:?{
??????????livereload:?true
????????}
??????},
??????js:?{
????????files:?['public/js/**',?'models/**/*.js',?'schemas/**/*.js'],
????????//tasks:?['jshint'],
????????options:?{
??????????livereload:?true
????????}
??????},
??????uglify:?{
????????files:?['public/**/*.js'],
????????tasks:?['jshint'],
????????options:?{
??????????livereload:?true
????????}
??????},
??????styles:?{
????????files:?['public/**/*.less'],
????????tasks:?['less'],
????????options:?{
??????????nospawn:?true
????????}
??????}
????},

????jshint:?{
??????options:?{
????????jshintrc:?'.jshintrc',
????????ignores:?['public/libs/**/*.js']
??????},
??????all:?['public/js/*.js',?'test/**/*.js',?'app/**/*.js']
????},

????less:?{
??????development:?{
????????options:?{
??????????compress:?true,
??????????yuicompress:?true,
??????????optimization:?2
????????},
????????files:?{
??????????'public/build/index.css':?'public/less/index.less'
????????}
??????}
????},

????uglify:?{
??????development:?{
????????files:?{
??????????'public/build/admin.min.js':?'public/js/admin.js',
??????????'public/build/detail.min.js':?[
????????????'public/js/detail.js'
??????????]
????????}
??????}
????},

????nodemon:?{
??????dev:?{
????????options:?{
??????????file:?'app.js',
??????????args:?[],
??????????ignoredFiles:?['README.md',?'node_modules/**',?'.DS_Store'],
??????????watchedExtensions:?['js'],
??????????watchedFolders:?['./'],
??????????debug:?true,
??????????delayTime:?1,
??????????env:?{
????????????PORT:?3000
??????????},
??????????cwd:?__dirname
????????}
??????}
????},

????mochaTest:?{
??????options:?{
????????reporter:?'spec'
??????},
??????src:?['test/**/*.js']
????},

????concurrent:?{
??????tasks:?['nodemon',?'watch',?'less',?'uglify',?'jshint'],
??????options:?{
????????logConcurrentOutput:?true
??????}
????}
??})

??grunt.loadNpmTasks('grunt-contrib-watch')
??grunt.loadNpmTasks('grunt-nodemon')
??grunt.loadNpmTasks('grunt-concurrent')
??grunt.loadNpmTasks('grunt-mocha-test')
??grunt.loadNpmTasks('grunt-contrib-less')
??grunt.loadNpmTasks('grunt-contrib-uglify')
??grunt.loadNpmTasks('grunt-contrib-jshint')

??grunt.option('force',?true)

??grunt.registerTask('default',?['concurrent'])

??grunt.registerTask('test',?['mochaTest'])
}


0 回復 有任何疑惑可以回復我~

我已經按照你的方法執行了,但報錯還是存在。

這是我的Gruntfile.js配置內容:

module.exports?=?function(grunt)?{
????grunt.initConfig({
????????watch?:?(省略),
????????nodemon?:?(省略),?
????????concurrent:?{
??????????target:?{
????????????tasks:?['nodemon',?'watch'],
????????????options:?{
??????????????logConcurrentOutput:?true
????????????}
??????????}
????????}
????})
????
????grunt.loadNpmTasks('grunt-contrib-watch');
????grunt.loadNpmTasks('grunt-nodemon');
????grunt.loadNpmTasks('grunt-concurrent');
????
????grunt.option('force',true);
????grunt.registerTask('default',['concurrent']);
}

但是不管我在npm里執行grunt,還是grunt concurrent。都報錯No "concurrent" targets found.

0 回復 有任何疑惑可以回復我~
#1

int30xcc

不是 grunt concurrent, 是在你 gruntfile.js所在目錄執行 gurnt 命令 就可以
2014-09-27 回復 有任何疑惑可以回復我~

npm install?grunt-concurrent --save


留意一下,是否能安裝成功。


直接?grunt concurrent 是需要你先注冊,也就是?registerTask 一個 grunt task 名字,然后才能在命令行里調用

0 回復 有任何疑惑可以回復我~
#1

JFeng 提問者

非常感謝你回答我的問題,但我還是沒有解決問題,請看我在下方的評論內容。
2014-09-26 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
node建站攻略(二期)——網站升級
  • 參與學習       51926    人
  • 解答問題       423    個

幫助你深入前后端開發留下的迷惑,為進一步自學打下基礎

進入課程
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號