'grunt'命令不做任何事情 [英] 'grunt' command doesn't do anything
问题描述
我对我的新应用程式执行了入门指南,但我遇到了一些麻烦。
这是我的Gruntfile.js
module.exports = function(grunt) {
//项目配置。
grunt.initConfig({
pkg:grunt.file.readJSON('package.json'),
uglify:{,
build:{
src: js / *。js',
dest:'build / *。min.js'
}
}
}
//加载提供uglify任务的插件。
grunt.loadNpmTasks('grunt-contrib-uglify');
//默认任务。
grunt.registerTask('default',['uglify']);
};
这是我的package.json
{
name:My App,
version:0.0.0,
description:,
author:,
license:N / A,
devDependencies:{
grunt:〜0.4.2,
grunt-contrib-jshint:〜0.8.0,
grunt-contrib-uglify:〜0.2.7
}
}
我安装了grunt-cli软件包,我运行了npm install来获取本地版本的grunt和contrib库。
但是当我运行 grunt
或 grunt uglify
没有任何反应。
$ grunt
$ grunt uglify
$
$ c $任何想法我错过了什么或可能导致这种行为?
编辑:我刚安装摩卡太,我得到同样的问题:没有输出。也许我的节点或npm安装有问题
解决方案所以看起来这是一个环境安装问题。我有一个ubuntu包称为节点安装以及nodejs,这阻止通过npm安装的软件包工作。运行以下命令解决了问题。
sudo apt-get --purge remove node
I'm following the grunt getting started guide for my new app, but I'm having some trouble.
This is my Gruntfile.js
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {,
build: {
src: 'js/*.js',
dest: 'build/*.min.js'
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
// Default task(s).
grunt.registerTask('default', ['uglify']);
};
This is my package.json
{
"name": "My App",
"version": "0.0.0",
"description": "",
"author": "",
"license": "N/A",
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-jshint": "~0.8.0",
"grunt-contrib-uglify": "~0.2.7"
}
}
I have the grunt-cli package installed and I've run npm install to get a local version of grunt and the contrib libraries.
But when I run either grunt
or grunt uglify
nothing happens.
$ grunt
$ grunt uglify
$
Any idea what I have missed or what could cause this behaviour?
EDIT: I just installed mocha too and I get the same issue with that: no output. Maybe there is a problem with my node or npm installation
解决方案 So it looks like this was an environment setup issue. I had an ubuntu package called node installed as well as nodejs which was preventing the packages installed through npm from working. Running the following command fixed the issue.
sudo apt-get --purge remove node
这篇关于'grunt'命令不做任何事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!