node.js - 咕噜初始化:node not working

标签 node.js windows-7 gruntjs

我正在尝试做一个介绍性的 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/

相关文章:

c - MinGW 中的 g++、make 和 GDB 安装在哪里?

vb6 - Windows 7 需要对 VB6 应用程序进行 UAC 提升(Vista 没有)

node.js - 使用 Protractor webdriver-manager 运行一项任务后 Grunt 停止

linux - 如何针对目录中的多个文件执行 Pig 脚本

node.js - Sublime Text 构建 : 'node' is not recognized as an internal or external command

node.js - nginx + node.js + websockets 的问题

node.js - req.session 没有方法 'touch' ?

javascript - req.flash() 在 req.session.destroy() 之后不工作

c# - 在 WIN 7 旗舰版中与来自 c++ 的数字签名 c# com dll 通信的问题

javascript - Grunt Lodash 模板可以在 Gruntfile.js 任务中使用吗?