我安装了Yeoman并开始使用官方文档中提供的示例。 我按照建议的操作进行了操作。
yo webapp
bower install underscore
grunt
运行grunt之后,我收到了以下消息
grunt-cli: The grunt command line interface. (v0.1.9)
Fatal error: Unable to find local grunt.
If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:
http://gruntjs.com/getting-started
请注意,grunt已安装。
npm install -g grunt-cli
并且
npm install -g grunt
在我运行命令的项目根目录下,yo已生成了Gruntfile.js。
同时也生成了package.json文件:
"name": "testyo",
"version": "0.0.0",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-concat": "~0.1.3",
"grunt-contrib-coffee": "~0.6.5",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-compass": "~0.2.0",
"grunt-contrib-jshint": "~0.4.1",
"grunt-contrib-cssmin": "~0.6.0",
"grunt-contrib-connect": "~0.2.0",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-imagemin": "~0.1.3",
"grunt-contrib-watch": "~0.4.0",
"grunt-rev": "~0.1.0",
"grunt-autoprefixer": "~0.1.20130516",
"grunt-usemin": "~0.1.10",
"grunt-mocha": "~0.3.0",
"grunt-open": "~0.2.0",
"grunt-svgmin": "~0.1.0",
"grunt-concurrent": "~0.1.0",
"matchdep": "~0.1.1",
"connect-livereload": "~0.2.0"
},
"engines": {
"node": ">=0.8.0"
}
此外。从根目录开始
grunt --version
grunt-cli v0.1.9
这意味着grunt可以在任何目录下运行。
有什么建议吗?
npm install
和bower install
。在软件世界中,有时也会出现 bug。可能由于某种原因,在构建脚手架时,该过程可能会在错误发生前就意外退出,导致默认情况下未能运行npm install
。 - Stephen