2014-01-20 2 views
7

저는 오늘 Yeoman 워크 플로우를 처음 사용했습니다. 자산 관리 프로세스를 자동화하기 위해 grunt bower-install을 설치하려고합니다.grunt bower-install을 설정하는 데 문제가 있습니다.

문제는 내가 문서의 지침을 마지막으로 실행 했음에도 불구하고 실행하려고 할 때 grunt bower-install 오류가 발생합니다. 홈 DIR에서이 명령을 실행하려고 할 때

이 오류는 다음과 같은

있습니다 :

[email protected]:~/app$ grunt bower-install 
Loading "gruntfile.js" tasks...ERROR 
>> Error: Unable to read "package.json" file (Error code: ENOENT). 
Warning: Task "bower-install" not found. Use --force to continue. 

Aborted due to warnings. 
:

[email protected]:~$ !! 
Running "bower-install:app" (bower-install) task 
Verifying property bower-install.app.src exists in config...ERROR 
>> Unable to process task. 
Warning: Required config property "bower-install.app.src" missing. Use --force to continue. 

Aborted due to warnings. 


Execution Time (2014-01-20 10:17:47 UTC) 
loading tasks  3ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 25% 
bower-install:app 8ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 67% 
Total 12ms 

응용 프로그램 디렉토리에 cding하고 명령을 다시 실행 한 후, 나는 다른 오류

어떤 도움도 훨씬 크게 받으실 수 있습니다! 다음과 같은

내 Gruntfile.js는 (응용 프로그램/디렉토리 내에서) 보이는 : 패키지 : 당신은 "읽을 수 없습니다 오류"프로젝트 디렉토리에 package.json 파일을 (누락되었습니다

'use strict'; 

module.exports = function (grunt) { 
    // Project configuration 
    grunt.initConfig({ 
     // Metadata 
     pkg: grunt.file.readJSON('package.json'), 
     banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + 
      '<%= grunt.template.today("yyyy-mm-dd") %>\n' + 
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + 
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + 
      ' Licensed <%= props.license %> */\n', 
     // Task configuration 
     concat: { 
      options: { 
       banner: '<%= banner %>', 
       stripBanners: true 
      }, 
      dist: { 
       src: ['lib/<%= pkg.name %>.js'], 
       dest: 'dist/<%= pkg.name %>.js' 
      } 
     }, 
     uglify: { 
      options: { 
       banner: '<%= banner %>' 
      }, 
      dist: { 
       src: '<%= concat.dist.dest %>', 
       dest: 'dist/<%= pkg.name %>.min.js' 
      } 
     }, 
     'bower-install': { 

      target: { 
      // Point to the files that should be updated when 
      // you run `grunt bower-install` 
      src: ['/home/oleg/index.html'], 

      // Optional: 
      // --------- 
      cwd: '', 
      ignorePath: '', 
      exclude: [], 
      fileTypes: {} 
      } 
     }, 
     jshint: { 
      options: { 
       curly: true, 
       eqeqeq: true, 
       immed: true, 
       latedef: true, 
       newcap: true, 
       noarg: true, 
       sub: true, 
       undef: true, 
       unused: true, 
       boss: true, 
       eqnull: true, 
       browser: true, 
       globals: { 
        jQuery: true 
       } 
      }, 
      gruntfile: { 
       src: 'gruntfile.js' 
      }, 
      lib_test: { 
       src: ['lib/**/*.js', 'test/**/*.js'] 
      } 
     }, 
     qunit: { 
      files: ['test/**/*.html'] 
     }, 
     watch: { 
      gruntfile: { 
       files: '<%= jshint.gruntfile.src %>', 
       tasks: ['jshint:gruntfile'] 
      }, 
      lib_test: { 
       files: '<%= jshint.lib_test.src %>', 
       tasks: ['jshint:lib_test', 'qunit'] 
      } 
     } 
    }); 

    // These plugins provide necessary tasks 
    grunt.loadNpmTasks('grunt-contrib-concat'); 
    grunt.loadNpmTasks('grunt-contrib-uglify'); 
    grunt.loadNpmTasks('grunt-contrib-qunit'); 
    grunt.loadNpmTasks('grunt-contrib-jshint'); 
    grunt.loadNpmTasks('grunt-contrib-watch'); 
    grunt.loadNpmTasks('grunt-bower-install'); 

    // Default task 
    grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']); 
}; 

답변

5

http://package.json.nodejitsu.com/ 당신은 당신의 프로젝트의 루트 디렉토리에서 grunt 명령을 실행하는 것이 맞다. 그러나, 나는 당신이 오류를 판단, 잘못된 grunt-bower-install 하위 작업을 실행하는 생각 :

Running "bower-install:app" (bower-install) task 
Verifying property bower-install.app.src exists in config...ERROR 
>> Unable to process task. 
Warning: Required config property "bower-install.app.src" missing. 

단순히 grunt bower-install을 실행하면 작동합니다. ... 어느 쪽이든, 또는

'bower-install': { 
    target: { /* ... */ } 
} 

에 이름을

'bower-install': { 
    app: { /* ... */ } 
} 
1

그것은 당신을 알려줍니다 .json "파일").

여기서 볼 수 있듯이 pkg: grunt.file.readJSON('package.json')은 gruntfile이 해당 파일을 읽으려고합니다.

그래서 package.json을 만든 다음, bower-install을 다시 시도하십시오. 그러면 적어도 시작될 것입니다.

package.json 파일에 대한

더 : https://npmjs.org/doc/json.html

관련 문제