我一直试图在我的Win 10 64位开发机器上测试Web应用程序生成器,所以我打开了一个PSShell命令窗口,并按照以下步骤
// 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任务没有定义)
咕哝式发球警告:找不到任务"serve"。使用--force继续。
在这一点上,我认为我现在确实需要询问社区;-)。也许我需要验证Bower等安装的版本
Daniel
新的生成器Web应用程序不再使用grunt。发电机发生了几次变化。新的生成器网络应用程序现在使用gump。
请查看以下位置的安装文档:生成器webapp