[英]grunt Warning Task “watch” not found
Gruntfile.js:
grunt.initConfig({
watch: {
compass: {
files: [
'app/styles/**/*.{scss,sass}'
],
tasks: 'compass reload'
},
.....
grunt.registerTask('dev', 'watch');
當我跑
grunt dev
我收到了錯誤
Warning: Task "watch" not found. Use --force to continue.
我使用grunt-cli v0.1.6和grunt v0.4.0,安裝了grunt-contrib-watch。
您不必安裝整個contrib-package。 有一個單獨的手表
npm install grunt-contrib-watch --save-dev
最后:
grunt.loadNpmTasks('grunt-contrib-watch');
好。
npm install grunt-contrib --save-dev
並在grunt.js的最后一行之前添加此行:
grunt.loadNpmTasks('grunt-contrib');
另外,我必須安裝Ruby ...
實際上,如果沒有安裝插件,你就不會有錯誤launcinh grunt watch
,只是一個無法加載watch
任務的錯誤。
我知道這個問題已經過時了,但是自從Serge說出來之后,它還沒有得到妥善回答
安裝了grunt-contrib-watch。
我會檢查整個Gruntfile是否被包裝
module.exports = function (grunt) {
};
當您過早關閉此功能(意外)時,您會收到所描述的錯誤。
瀏覽器更新和npm更新對我有用。
當我在終端上運行grunt watch時遇到錯誤並修復:
錯誤
grunt watch
Loading "Gruntfile.js" tasks...ERROR
在終端修復
brew install npm
brew install node
然后你測試節點和npm工作
node -v npm -v
安裝Grunt
npm install -g grunt-cli npm install grunt-contrib-watch --save-dev
安裝Composer
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
然后跑了
grunt watch
有效!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.