Grunt发送警告:找不到任务“服务”。使用--force继续。(重访)

时间:2016-04-16 10:40:15

标签: node.js gruntjs yo

我一直试图在我的Win 10 64位Dev机器上测试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-comma

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任务)

咕噜声    警告:找不到任务“服务”。使用--force继续。

此时我觉得我现在需要问社区;-)。也许我需要验证Bower等安装的版本

丹尼尔

1 个答案:

答案 0 :(得分:1)

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

请查看以下安装文档: generator-webapp

相关问题