我正在尝试做一个介绍性的 grunt 教程。我已经全局安装了 git、node.js 和 grunt(或者至少我认为我使用了:npm install -g grunt(安装)。然后我创建了一个快速目录并输入它(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
关于node.js - 咕噜初始化:node not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20561806/