Angularjs 使用grung模板时找不到本地grunt

Angularjs 使用grung模板时找不到本地grunt,angularjs,npm,gruntjs,Angularjs,Npm,Gruntjs,按照设置grunt角度模板的说明进行操作: 我通过以下操作安装grunt angular模板: npm install grunt-angular-templates --save-dev 它安装 My package.json只是一个非常简单的示例: { "name": "grunt_example2", "version": "0.0.0", "description": "", "main": "index.js", "dependencies": { "gr

按照设置grunt角度模板的说明进行操作:

我通过以下操作安装grunt angular模板:

npm install grunt-angular-templates --save-dev
它安装

My 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
我得到: 致命错误:找不到本地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
但这并没有告诉我如何解决这个问题

有什么建议吗


谢谢。

您需要在项目中安装grunt。请看这里:


npm安装grunt——保存开发人员,这可能会有所帮助。但为什么它必须是本地的呢?我想做sudo npm安装-ggrunt@FutuToad您需要全局安装“grunt cli”(这将创建“grunt”应用程序),然后需要在本地安装“grunt”以运行任务。请阅读文档。明白了!但是需要把所有东西都放在本地是很奇怪的