0

Win 10 64 ビット Dev マシンで Web アプリ ジェネレーターをテストしようとしてきたので、PS シェル コマンド ウィンドウを開き、次の手順に従いました。

 // 1. Install core of yeoman
 npm install -g yo
 // Wait until yeoman installation is completed
 // 2. Install bower
npm install -g bower
// Wait until bower installation is completed
// 3. Install Grunt Client
 npm install -g grunt-cli
// Wait until grunt client installation is completed
// 4. Install the first generator
npm install -g generator-webapp

  *npm WARN deprecated graceful-fs@2.0.3: graceful-fs version 3 and before
  will fail on newer node releases. Please update to graceful-fs@^4.0.0 as
  soon as possible*.

 // if I temporarily "ignore" the error and carry on..... 
 // note I notice my npm version was old so altered the system path and now 
 // 3.8.7

mkdir test
cd test
yo WebApp

grunt serve

A valid Gruntfile could not be found. Please see the getting started
guide for  more information on how to configure grunt: 
http://gruntjs.com/getting-started

それはいい!

少し検索して、これを見つけました http://www.unknownerror.org/opensource/gruntjs/grunt/q/stackoverflow/15483735/quotfatal-error-unable-to-find-local-grunt-quot-when-running- quotgruntquot-カンマ

module.exports = function(grunt) {

grunt.initConfig({
jshint: {
  files: ['Gruntfile.js', 'App/**/*.js', 'test/**/*.js'],
  options: {
    globals: {
      jQuery: true
    }
  }
 },
watch: {
  files: ['<%= jshint.files %>'],
  tasks: ['jshint']
  }
  });

 grunt.loadNpmTasks('grunt-contrib-jshint');
 grunt.loadNpmTasks('grunt-contrib-watch');

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

 };

今、私はこのエラーに遭遇しました(私はServeタスクが定義されていないことを知っています)

grunt serve 警告: タスク "serve" が見つかりません。--force を使用して続行します。

この時点で、コミュニティに質問する必要があると思いました ;-)。インストールされている Bower などのバージョンを確認する必要があるかもしれません

ダニエル

4

1 に答える 1

1

新しい generator-webapp は grunt を使用しなくなりました。ジェネレーターにはいくつかの変更がありました。新しい generator-webapp は gulp を使用するようになりました。

次のインストール ドキュメントを確認してください: generator-webapp

于 2016-04-18T20:49:22.597 に答える