本文翻译自:What is causing this error - “Fatal error: Unable to find local grunt”

I removed the old version of grunt first, then I installed the new grunt version, and then I got this error: 我首先删除了旧版本的grunt,然后我安装了新的grunt版本,然后我收到了这个错误:

D:\\www\\grunt-test\\grunt grunt-cli: The grunt command line interface. D:\\ www \\ grunt-test \\ grunt grunt-cli:grunt命令行界面。 (v0.1.4) (v0.1.4)

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. 如果您看到此消息,则表示未找到Gruntfile或者您的项目未在本地安装grunt。 For more information about installing and configuring grunt, please see the Getting Started guide: http://gruntjs.com/getting-started 有关安装和配置grunt的更多信息,请参阅“入门指南”: http : //gruntjs.com/getting-started

Is this because there is not a reference to grunt in my system path? 这是因为我的系统路径中没有对grunt的引用吗? Or something else? 或者是其他东西? I tried to re-install it a few times already. 我试过几次重新安装它。


#1楼

参考:https://stackoom.com/question/wQlY/导致此错误的原因是什么-致命错误-无法找到本地咕噜声


#2楼

I think you don't have a grunt.js file in your project directory. 我认为你的项目目录中没有grunt.js文件。 Use grunt:init , which gives you options such as jQuery, node,commonjs . 使用grunt:init ,它为您提供jQuery, node,commonjs等选项。 Select what you want, then proceed. 选择你想要的,然后继续。 This really works. 这确实有效。 For more information you can visit this . 有关更多信息,请访问此页面 。

Do this: 做这个:

 1. npm install -g grunt2. grunt:init  ( you will get following options ):jquery: A jQuery pluginnode: A Node modulecommonjs: A CommonJS modulegruntplugin: A Grunt plugingruntfile: A Gruntfile (grunt.js)3 .grunt init:jquery (if you want to create a jQuery related project.).

It should work. 它应该工作。

Solution for v1.4: v1.4的解决方案:

1. npm install -g grunt-cli
2. npm initfill all details and it will create a package.json file.
3. npm install grunt (for grunt dependencies.)

Edit : Updated solution for new versions: 编辑:更新了新版本的解决方案:

 npm install grunt --save-dev

#3楼

Install Grunt in node_modules rather than globally 在node_modules中安装Grunt而不是全局安装

Unable to find local Grunt likely means that you have installed Grunt globally. Unable to find local Grunt可能意味着您已在全球范围内安装了Grunt。

The Grunt CLI insists that you install grunt in your local node_modules directory, so Grunt is local to your project. Grunt CLI坚持要在本地node_modules目录中安装grunt,因此Grunt是您项目的本地目录。

This will fail: 这将失败:

npm install -g grunt

Do this instead: 改为:

npm install grunt --save-dev

#4楼

If you already have a file package.json in the project and it contains grunt in dependency, 如果你在项目中已经有一个文件package.json ,它包含依赖的grunt

  "devDependencies": {"grunt": "~0.4.0",

Then you can run npm install to resolve the issue 然后你可以运行npm install来解决这个问题


#5楼

Do

npm install

to install Grunt locally in ./node_modules (and everything else specified in the package.json file) ./node_modules本地安装Grunt(以及package.json文件中指定的所有其他内容)


#6楼

Could be a few problems here depending on what version of grunt is being used. 这可能是一些问题,具体取决于使用的grunt版本。 Newer versions of grunt actually specify that you have a file named Gruntfile.js (instead of the old grunt.js ). 较新版本的grunt实际上指定您有一个名为Gruntfile.js的文件(而不是旧的grunt.js )。

You should have the grunt-cli tool be installed globally (this is done via npm install -g grunt-cli ). 您应该全局安装grunt-cli工具(这可以通过npm install -g grunt-cli )。 This allows you to actually run grunt commands from the command line. 这允许您从命令行实际运行grunt命令。

Secondly make sure you've installed grunt locally for your project. 其次,请确保您已在本地为您的项目安装了grunt。 If you see your package.json doesn't have something like "grunt": "0.4.5" in it then you should do npm install grunt --save in your project directory. 如果你看到你的package.json没有类似"grunt": "0.4.5"的东西那么你应该在项目目录中执行npm install grunt --save

导致此错误的原因是什么 - “致命错误:无法找到本地咕噜声”相关推荐

  1. 导致403错误的原因和解决方法

    一.导致403错误的主要原因 403 Forbidden错误的原因和解决方法 1.你的IP被列入黑名单. 2.你在一定时间内过多地访问此网站(一般是用采集程序),被防火墙拒绝访问了. 3.网站域名解析 ...

  2. rgba无效php,ValueError:无效的RGBA参数:导致此错误的原因是什么?

    我正在尝试使用来自:this stackoverflow post的想法创建一个三维彩色条形图. 首先,我使用以下代码创建一个三维条形图:import numpy as np import matpl ...

  3. 字符集导致编码错误的原因

    这样的话,我们一般要使用转换流来避免以上这些问题. Reader inputStreamReader = new InputStreamReader(new FileInputStream(" ...

  4. java10个基础错误_我们处理了10亿个Java记录的错误-这是导致97%的错误的原因

    java10个基础错误 97%的记录错误是由10个唯一错误引起的 在2016年,一件事在30年内没有改变. 开发和运营团队仍依靠日志文件对应用程序问题进行故障排除. 由于某些未知原因,我们隐式信任日志 ...

  5. 我们处理了10亿个Java记录的错误-这是导致97%的错误的原因

    97%的记录错误是由10个唯一错误引起的 在2016年,一件事已经30年没有改变了. 开发和运营团队仍依靠日志文件对应用程序问题进行故障排除. 由于某些未知原因,我们隐式地信任日志文件,因为我们认为事 ...

  6. 这四个原因会导致域名解析错误

    域名和主机是搭建网站必不可少的两个因素,域名解析则是网站运行的灵魂,一旦域名解析出现错误,除了导致网站运行.运营和优化工作外,也会影响到用户的浏览体验,并直接导致网站在搜索引擎的排名下降. 域名解析错 ...

  7. python import random 报错_导致python中import错误的原因是什么

    Python程序可以调用一组基本的函数(即内建函数),比如print().input()和len()等函数.Python本身也内置一组模块(即标准库).每个模块都是一个Python程序,且包含了一组相 ...

  8. java中502错误原因_Spring Boot连接超时导致502错误的实战案例

    Spring Boot连接超时导致502错误的实战案例,错误,时间,客户端,站长站,原因 Spring Boot连接超时导致502错误的实战案例 易采站长站,站长之家为您整理了Spring Boot连 ...

  9. 导致jquery.min.map 404 (Not Found)错误的原因

    1.报错找不到jquery.min.map 当打开引入jQuery脚本的页面时,在Chrome的控制台中报了"GET http://localhost/libs/jquery.min.map ...

最新文章

  1. html文字中横线_谈PPT课件中自定义动画应用之内容控制
  2. 5G+AI,中国版无人驾驶可以有多猛?
  3. 部署SSL证书中的风险
  4. Silverlight 2 数据绑定演示程序(附源代码下载)
  5. VC++ ipaddress控件的使用
  6. Android 须知2019流行的框架库及开发语言
  7. 可局部放大图片的例子,局部放大图片,javascript局部放大图片
  8. 我国物联网发展如何跳出“窄巷”?
  9. [Swift]LeetCode609. 在系统中查找重复文件 | Find Duplicate File in System
  10. 2.页面截长图工具-FireShot
  11. centeros 下载及安装
  12. 极化码的巴氏参数构造算法
  13. 绝对地址、相对地址、/、./、../之间的区别
  14. springboot集成openoffice实现office转PDF在线预览
  15. 《那些年啊,那些事——一个程序员的奋斗史》——10
  16. October 2019 Twice SQL Injection
  17. 最长上升子序列(c++图文详解)
  18. Error contacting service. It is probably not running解决
  19. 传统文化群聊摘录(不定时更新)
  20. Java调用Zebra800条码打印机

热门文章

  1. MySQL · 源码分析 · MySQL 半同步复制数据一致性分析
  2. Android获取SharedPreferences失败,且App无法启动
  3. 第一次装TFS的曲折经历
  4. 物流公司老板血泪史:我如何被山寨版物流软件毁掉
  5. MongoDB管理与监控
  6. ORA-00018-超出最大连接数
  7. .NET 基础 一步步 一幕幕 [前言]
  8. 如何在没有域的环境中搭建AlwaysOn(二)
  9. MFC修改窗口无标题和标题信息,修改执执行文件图标
  10. Nginx压测性能优化