grunt init:节点不工作



我正在尝试做一个入门教程。我已经在全局范围内安装了git、node.js和grunt(或者至少我认为我使用了:npm install-ggrunt(安装))。然后我制作了一个快速目录并输入它(mkdir demo,cd demo),但当我键入:时

> grunt init:node

在提示下,我得到以下信息:

grunt-cli: The grunt command line interface (v0.1.11)
Fatal error: unable to find local grunt
If you're seeing this message, either a Gruntfile wasn't found or 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

我看了一遍,上面写着做我正在做的事情,教程提到了什么???你知道我做错了什么吗?Node.js和Git一直运行良好,所以我只能假设是grunt或安装失败。

感谢

使用grunt需要两个元素。使用npm install -g grunt-cli安装的全局grunt cli,以及grunt本身的本地副本(对于项目)。因此,在项目的文件夹中,用npm install grunt --saveDev安装它,这将安装一个本地grunt,并将其添加到package.json文件中的devDependencies中。您还需要在项目文件夹中使用Gruntfile.js。这是一篇很棒的文章http://www.integralist.co.uk/Grunt-Boilerplate.html

最新更新