发出咕声,并显示“无法找到本地咕gr声". [英] Grunt concat failing with "Unable to find local grunt"

查看:83
本文介绍了发出咕声,并显示“无法找到本地咕gr声".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经像这样安装了Grunt,所以`npm install -g grunt-cli成功了.

I have installed Grunt like so `npm install -g grunt-cli successfully.

我还成功安装了grunt-contrib-concat库,如下所示:npm install grunt-contrib-concat --save-dev

I have also installed the grunt-contrib-concat libary succesfully like so: npm install grunt-contrib-concat --save-dev

我创建了package.json:

{
  "name": "my-project-name",
  "version": "0.1.0",
  "devDependencies": {
    "grunt": "~0.4.1",
    "grunt-contrib-jshint": "~0.1.1",
    "grunt-contrib-nodeunit": "~0.1.2"
  }
}

Gruntfile.js:

module.exports = function(grunt) {

grunt.initConfig({
  pkg: grunt.file.readJSON('package.json'),
  concat: {
    options: {
      separator: ';'
    },
    dist: {
      src: ['src/init.js', 'src/Game.js', 'ui/Ui.js', 'ui/AddBTS.js', 'ui/Toolbar.js'],
      dest: 'built.js'
    }
  }
});

grunt.loadNpmTasks('grunt-contrib-concat');

};

现在,当我运行grunt concat时,出现以下错误:

Now when I run grunt concat I get the following error:

致命错误:无法找到本地咕unt声. 如果您看到此消息,则说明找不到Gruntfile或gruntfile 尚未在您的项目本地安装.有关更多信息 安装和配置grunt,请参阅《入门指南》:

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:

这是我第一次使用Grunt,现在已经尝试解决这个问题2个多小时.请有人帮助我,并告诉我我没有正确设置的内容.

This is my first time using Grunt and I've been trying to solve this problem for over 2 hours now. Please could someone help me and advise what I've not set up correctly.

提前谢谢!

推荐答案

很有可能在您的项目文件夹中未本地安装Grunt(这与grunt-cli不同).您将其保存在package.json中,因此请尝试执行npm installnpm install grunt替代.

It's likely that Grunt is not installed locally in your project folder (which is different than grunt-cli). You have it in your package.json so try doing npm install or alternately npm install grunt.

有关更多信息,请参见入门页面:

For more information see the getting started page:

请注意,安装grunt-cli不会安装grunt任务运行程序! grunt CLI的工作很简单:运行Gruntfile旁边已安装的grunt版本.这样一来,即可在同一台计算机上同时安装多个版本的grunt.

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.

这篇关于发出咕声,并显示“无法找到本地咕gr声".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆