【问题标题】:Unable to find local grunt when using grung ngtemplates使用 grun ngtemplates 时无法找到本地 grunt
【发布时间】:2013-11-28 19:15:42
【问题描述】:

按照设置 grunt 角度模板的说明:https://npmjs.org/package/grunt-angular-templates

我通过以下方式安装 grunt-angular-template:

npm install grunt-angular-templates --save-dev

它会安装。

我的 package.json 只是一个很简单的:

{
  "name": "grunt_example2",
  "version": "0.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "grunt-angular-templates": "~0.4.7"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "BSD-2-Clause"
}

我创建了一个 Gruntfile.js 作为

module.exports = function(grunt) {
  grunt.loadTasks('grunt-angular-templates');
}

当我这样做时:

grunt ngtemplates

我得到: 致命错误:无法找到本地咕噜声。

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

但这并没有告诉我如何解决这个问题。

有什么建议吗?

谢谢。

【问题讨论】:

标签: angularjs npm gruntjs


【解决方案1】:

您需要将 grunt 安装到您的项目中。见这里:http://gruntjs.com/getting-started#installing-grunt-and-gruntplugins

npm install grunt --save-dev

【讨论】:

  • 但为什么它必须是本地的?我想做 sudo npm install -g grunt
  • @FutuToad 您需要全局安装“grunt-cli”(这将创建“grunt”应用程序),然后您需要在本地安装“grunt”以运行任务。请阅读文档。
  • 明白了!但是需要在本地安装所有东西很奇怪
猜你喜欢
  • 2023-03-13
  • 2016-07-24
  • 2019-03-08
  • 2014-10-22
  • 2013-03-19
  • 2013-08-09
  • 2017-12-20
  • 1970-01-01
  • 2016-08-05
相关资源
最近更新 更多