2014-11-09 2 views
2

그르 턴 반환 오류 "대상이 없습니다." 또는 "작업 * 찾을 수 없습니다." 모든 작업. 또한 grunt --help는 "빌드"및 "테스트"작업과 같이 사용 가능한 일부 작업을 표시하지 않습니다.그르 트는 모든 작업에 대해 오류를 반환합니다.

이 구성은 이전처럼 작동하는 것 같습니다. 하지만 그것은 바뀌지 않았습니다 (자식은 이것을 보장합니다).

무엇이 문제입니까? 여기

내 Gruntfile.js입니다 :

{ 
    "name": "", 
    "version": "0.0.0", 
    "dependencies": {}, 
    "devDependencies": { 
    "bower": "~1.3.12", 
    "coffeelint": "^1.6.0", 
    "grunt": "~0.4.1", 
    "grunt-autoprefixer": "~0.3.0", 
    "grunt-concurrent": "~1.0.0", 
    "grunt-contrib-clean": "~0.6.0", 
    "grunt-contrib-coffee": "~0.12.0", 
    "grunt-contrib-compass": "~1.0.1", 
    "grunt-contrib-concat": "~0.5.0", 
    "grunt-contrib-connect": "^0.8.0", 
    "grunt-contrib-copy": "~0.7.0", 
    "grunt-contrib-handlebars": "^0.9.0", 
    "grunt-contrib-htmlmin": "~0.3.0", 
    "grunt-contrib-imagemin": "~0.8.1", 
    "grunt-contrib-requirejs": "^0.4.4", 
    "grunt-contrib-uglify": "~0.6.0", 
    "grunt-contrib-watch": "~0.6.1", 
    "grunt-karma": "~0.9.0", 
    "grunt-mocha": "~0.4.11", 
    "grunt-newer": "^0.7.0", 
    "grunt-notify": "^0.3.1", 
    "grunt-phonegap": "~0.15.2", 
    "grunt-svgmin": "~1.0.0", 
    "load-grunt-config": "^0.13.2", 
    "load-grunt-tasks": "~0.6.0", 
    "time-grunt": "~1.0.0" 
    }, 
    "engines": { 
    "node": ">=0.10.0" 
    } 
} 

모든 종속성 작업이로드됩니다

module.exports = function(grunt) { 
    require('time-grunt')(grunt); 
    require('load-grunt-tasks')(grunt); 
    grunt.initConfig({ 
    yeoman: { 
     app: 'app', 
     dist: 'dist' 
    }, 
    phonegap: { 
     config: { 
     root: 'dist', 
     config: 'config.xml', 
     cordova: '.cordova', 
     path: 'phonegap', 
     plugins: [], 
     platforms: ['ios', 'android', 'wp8'], 
     verbose: false 
     } 
    }, 
    compass: { 
     server: { 
     options: { 
      sassDir: '<%= yeoman.app %>/styles/', 
      cssDir: '.tmp/styles/' 
     } 
     }, 
    }, 
    watch: { 
     compass: { 
     files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'], 
     tasks: ['compass:server', 'autoprefixer'] 
     }, 
     styles: { 
     files: ['<%= yeoman.app %>/styles/{,*/}*.css'], 
     tasks: ['copy:styles', 'autoprefixer'] 
     }, 
     livereload: { 
     options: { 
      livereload: '<%= connect.options.livereload %>' 
     }, 
     files: ['<%= yeoman.app %>/*.html', '.tmp/styles/{,*/}*.css', '{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js', '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'] 
     } 
    }, 
    connect: { 
     options: { 
     port: 9000, 
     livereload: 35729, 
     hostname: 'localhost' 
     }, 
     livereload: { 
     options: { 
      open: true, 
      base: ['.tmp', '<%= yeoman.app %>'] 
     } 
     }, 
     test: { 
     options: { 
      base: ['.tmp', 'test', '<%= yeoman.app %>'] 
     } 
     }, 
     dist: { 
     options: { 
      open: true, 
      base: '<%= yeoman.dist %>' 
     } 
     } 
    }, 
    clean: { 
     dist: { 
     files: [{ 
      dot: true, 
      src: ['.tmp', '<%= yeoman.dist %>/*', '!<%= yeoman.dist %>/.git*'] 
     }] 
     }, 
     server: '.tmp' 
    }, 
    jshint: { 
     options: { 
     jshintrc: '.jshintrc' 
     }, 
     all: ['Gruntfile.js', '<%= yeoman.app %>/scripts/{,*/}*.js', '!<%= yeoman.app %>/scripts/vendor/*' 
     // 'test/spec/{,*/}*.js' 
     ] 
    }, 
    karma: { 
     options: { 
     files: ['test/**/*.js'] 
     }, 
     continuous: {}, 
     dev: {} 
    }, 
    mocha: { 
     all: { 
     options: { 
      run: true, 
      urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html'] 
     } 
     } 
    }, 
    autoprefixer: { 
     options: { 
     browsers: ['last 1 version'] 
     }, 
     dist: { 
     files: [{ 
      expand: true, 
      cwd: '.tmp/styles/', 
      src: '{,*/}*.css', 
      dest: '.tmp/styles/' 
     }] 
     } 
    }, 
    'bower-install': { 
     app: { 
     html: '<%= yeoman.app %>/index.html', 
     ignorePath: '<%= yeoman.app %>/' 
     } 
    }, 
    rev: { 
     dist: { 
     files: { 
      src: ['<%= yeoman.dist %>/scripts/{,*/}*.js', '<%= yeoman.dist %>/styles/{,*/}*.css', '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}', '<%= yeoman.dist %>/styles/fonts/{,*/}*.*'] 
     } 
     } 
    }, 
    useminPrepare: { 
     options: { 
     dest: '<%= yeoman.dist %>' 
     }, 
     html: '<%= yeoman.app %>/index.html' 
    }, 
    usemin: { 
     options: { 
     dirs: ['<%= yeoman.dist %>'] 
     }, 
     html: ['<%= yeoman.dist %>/{,*/}*.html'], 
     css: ['<%= yeoman.dist %>/styles/{,*/}*.css'] 
    }, 
    imagemin: { 
     dist: { 
     files: [{ 
      expand: true, 
      cwd: '<%= yeoman.app %>/images', 
      src: '{,*/}*.{png,jpg,jpeg}', 
      dest: '<%= yeoman.dist %>/images' 
     }] 
     } 
    }, 
    svgmin: { 
     dist: { 
     files: [{ 
      expand: true, 
      cwd: '<%= yeoman.app %>/images', 
      src: '{,*/}*.svg', 
      dest: '<%= yeoman.dist %>/images' 
     }] 
     } 
    }, 
    cssmin: { 
    }, 
    htmlmin: { 
     dist: { 
     options: { 
     }, 
     files: [{ 
      expand: true, 
      cwd: '<%= yeoman.app %>', 
      src: '*.html', 
      dest: '<%= yeoman.dist %>' 
     }] 
     } 
    }, 
    copy: { 
     dist: { 
     files: [{ 
      expand: true, 
      dot: true, 
      cwd: '<%= yeoman.app %>', 
      dest: '<%= yeoman.dist %>', 
      src: ['*.{ico,png,txt}', '.htaccess', 'images/{,*/}*.{webp,gif}', 'res/**', 'styles/fonts/{,*/}*.*', 'bower_components/**'] 
     }] 
     }, 
     styles: { 
     expand: true, 
     dot: true, 
     cwd: '<%= yeoman.app %>/styles', 
     dest: '.tmp/styles/', 
     src: '{,*/}*.css' 
     } 
    }, 
    concurrent: { 
     server: [/*'copy:styles'*/ 'compass'], 
     test: [/*'copy:styles'*/ 'compass'], 
     dist: [/*'copy:styles'*/ 'compass', 'imagemin', 'svgmin', 'htmlmin'] 
    } 
    }); 
    grunt.registerTask('server', function(target) { 
    if (target === 'dist') { 
     return grunt.task.run(['build', 'connect:dist:keepalive']); 
    } 
    grunt.task.run(['clean:server', 'concurrent:server', 'autoprefixer', 'connect:livereload', 'watch']); 
    }); 
    grunt.registerTask('test', ['clean:server', 'concurrent:test', 'autoprefixer', 'connect:test', 'mocha']); 
    grunt.registerTask('build', ['clean:dist', 'useminPrepare', 'concurrent:dist', 'autoprefixer', 'concat', 'cssmin', 'uglify', 'copy:dist', 'rev', 'usemin']); 
    grunt.registerTask('platform-build', ['default', 'phonegap:build']); 
    grunt.registerTask('default', ['jshint', 
    'build' 
    ]); 
}; 

내 package.json에서 ('로드 꿀꿀 - 작업') (꿀꿀)가 필요 npm으로 설치합니다.

+0

...은'--verbose' 플래그가 문제의 뿌리를 가리 추가 세부 사항을 제공 추가합니까? –

답변

0

어디서 작업을로드하고 있습니까? Grunt에서 NPM을 구성하고 실행하려면 먼저 NPM을 사용하여 작업을로드해야합니다. here을 참조하십시오.

다음은 그런트 사이트에서 예입니다 :

module.exports = function(grunt) { 

    // Project configuration. 
    grunt.initConfig({ 
    pkg: grunt.file.readJSON('package.json'), 
    uglify: { 
     options: { 
     banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' 
     }, 
     build: { 
     src: 'src/<%= pkg.name %>.js', 
     dest: 'build/<%= pkg.name %>.min.js' 
     } 
    } 
    }); 

    // Load the plugin that provides the "uglify" task. 
    grunt.loadNpmTasks('grunt-contrib-uglify'); 

    // Default task(s). 
    grunt.registerTask('default', ['uglify']); 

}; 
+0

require ('load-grunt-tasks') (grunt)는 내 package.json에 나열된 모든 작업을로드합니다. –

+0

@WlodzislavK. 흠, NPM 설치를 실행 했습니까? 모듈이 있다고 확신합니까? – linstantnoodles

관련 문제