“致命错误:无法找到本地咕噜声”。当运行“咕噜声”时,命令 [英] "Fatal error: Unable to find local grunt." when running "grunt" command
问题描述
npm uninstall -g grunt
然后我再次使用以下命令安装了grunt。
npm install -g grunt-cli
访问以下链接:
https://npmjs.org/package/grunt-html
我想使用上面的grunt插件
但是当我运行grunt命令时,它给了我下面的错误:
D:\\\
odeJS\\\
ode_modules\grunt-html> grunt
grunt-cli:grunt命令行界面。 (v0.1.6)
致命错误:无法找到本地咕噜声。
如果您看到此消息,找不到Gruntfile,或者grunt
没有在本地安装到您的项目中。有关
安装和配置grunt的更多信息,请参阅入门指南:
http://gruntjs.com/getting-started
解决方案在 gruntjs.com 。
请注意,安装grunt-cli不会安装grunt任务运行器!
grunt CLI的工作很简单:运行grunt的版本,其中
已安装在Gruntfile旁边。这允许多个版本的
grunt被同时安装在同一台机器上。
所以在你的项目文件夹中,需要安装(最好)安装最新的grunt版本:
npm install grunt --save-dev
选项
- save-dev
会添加grunt
作为 dev-dependency 添加到 package.json 中。这可以很容易地重新安装依赖关系。I uninstalled grunt with following command.
npm uninstall -g grunt
Then I again installed grunt with following command.
npm install -g grunt-cli
Visit following link: https://npmjs.org/package/grunt-html
I want to use the above grunt plugin
But when I run the grunt command it gives me following error:
D:\nodeJS\node_modules\grunt-html>grunt grunt-cli: The grunt command line interface. (v0.1.6) 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
解决方案All is explained quite nicely on gruntjs.com.
Note that installing grunt-cli does not install the grunt task runner! The job of the grunt CLI is simple: run the version of grunt which has been installed next to a Gruntfile. This allows multiple versions of grunt to be installed on the same machine simultaneously.
So in your project folder, you will need to install (preferably) the latest grunt version:
npm install grunt --save-dev
Option
--save-dev
will addgrunt
as a dev-dependency to your package.json. This makes it easy to reinstall dependencies.这篇关于“致命错误:无法找到本地咕噜声”。当运行“咕噜声”时,命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!