我根本无法让 grunt 在 Windows 7 上工作。按照 Grunt 网站上的说明进行操作 (http://gruntjs.com/getting-started http://gruntjs.com/getting-started)我已经跑了:
npm uninstall -g grunt-cli
npm uninstall grunt
npm uninstall -g grunt-init
git clone [email protected] /cdn-cgi/l/email-protection:gruntjs/grunt-init-jquery.git c:/Users/me/.grunt-init/jquery
npm install -g grunt-cli
grunt-init jquery
npm install .
之后,运行“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
npm list grunt 的输出是:
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
npm WARN package.json [email protected] /cdn-cgi/l/email-protection 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.
C:\Users\me\AppData\Roaming\npm
└─┬ [email protected] /cdn-cgi/l/email-protection
└── [email protected] /cdn-cgi/l/email-protection
在当前目录中运行“npm install grunt”会在运行 grunt 时出现相同的错误。
有什么想法吗?我的理解是 grunt-cli 是为了寻找本地 grunt 安装,但我不明白为什么它找不到它。
我知道这个问题被问到已经有两年了。但是,如果将来有人想要:
我遇到了完全相同的问题。我通过安装 grunt 解决了这个问题locally。根据咕噜声site http://gruntjs.com/getting-started,
请注意,安装 grunt-cli 不会安装 Grunt 任务运行程序!
Grunt CLI 的工作很简单:运行具有以下功能的 Grunt 版本:
已安装在 Gruntfile 旁边。这允许多个版本
Grunt 要同时安装在同一台机器上。
所以我只是通过在本地安装 Grunt 来让它工作。
npm install grunt --save-dev
--save :将其添加到您的 package.json 中。
-dev:将其添加为开发依赖项。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)