0

我一直在尝试在我的 Win 10 64 位开发机器上测试 Web App 生成器,所以我打开一个 PS Shell 命令窗口并按照以下步骤操作

 // 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']);

 };

现在我遇到了这个错误(我知道未定义服务任务)

grunt serve 警告:找不到任务“服务”。使用 --force 继续。

在这一点上,我想我现在确实需要询问社区 ;-)。也许我需要验证安装的 Bower 等版本

丹尼尔

4

1 回答 1

1

新的 generator-webapp 不再使用 grunt。发电机有几个变化。新的 generator-webapp 现在使用 gulp。

请检查安装文档: generator-webapp

于 2016-04-18T20:49:22.597 回答