Reputation: 229
I'm a newbie in Angular and I've cloned a repo (angular-slider). My problem is that when I type in console grunt serve it says Warning: Task "serve" not found. Use --force to continue. I've been searching through Internet and I've tried everything. I don't know which is the origin of my problem. If I type node -v the console gives me this v0.10.33 and if I type npm -v I get this 2.11.2 I already have a Gruntfile.js and a package.json and bower.json at the same level folder that my root project directory. Any help would be appreciated.
Edited:
This is my Gruntfile.js
module.exports = function(grunt){
'use strict';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
srcFiles: [
'src/rangeInputSupported.js',
'src/angular-slider.js'
],
concat: {
prod: {
src: ['<%= srcFiles %>'],
dest: 'build/<%= pkg.name %>.js'
}
},
uglify: {
options: {
banner: '/*\n <%= pkg.name %> v<%= pkg.version %> \n (c) 2013-2014 Venturocket, Inc. http://github.com/Venturocket \n License: MIT \n*/\n'
},
build: {
src: ['<%= srcFiles %>'],
dest: 'build/<%= pkg.name %>.min.js'
}
},
jshint: {
options: {
jshintrc: true,
reporter: require('jshint-stylish')
},
all: {
src: [
'Gruntfile.js',
'karma.conf.js',
'src/**/*.js',
'test/**/*.js'
],
options: {
force: true
}
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
// Default task(s).
grunt.registerTask('default', ['jshint:all', 'uglify', 'concat:prod']);
grunt.loadNpmTasks('grunt-contrib-concat');
};
And my bower.json looks like this:
{
"name": "angular-slider",
"version": "0.3.2",
"main": "./build/angular-slider.js",
"ignore": [
"**/.*",
"node_modules",
"components",
"lib",
"src",
"test",
".g*",
".editorconfig",
".jshintrc",
".travis.yml",
"Gruntfile.js",
"karma.conf.js",
"*.html"
],
"dependencies": {
"angular": "~1.2",
"angular-touch": "~1.2"
},
"devDependencies": {
"angular-mocks": "*",
"angular-scenario": "*"
},
"resolutions": {
"angular": "v1.2.16"
}
}
Upvotes: 3
Views: 8256
Reputation: 2351
Just do
grunt
...on its own. This runs the 'default' task
We can see toward the bottom of your GruntFile.js that you have a definition of the 'default' task
grunt.registerTask('default', ['jshint:all', 'uglify', 'concat:prod']);
...which I think will be the one to start up the server
I had thought that "serve" was a standard task name (also with alias "server") but I'm seeing gruntfiles where these are not defined, and where the "default" (just the grunt
command on its own) starts the server. Maybe this is a standard thing with Angular(?)
Upvotes: 0
Reputation: 2671
Make sure that you have 'serve' registeredTask in your gruntFile.js .
If it is there then probably grunt is not installed on your system. Install grunt-cli from npm and also the bower on your system. So that you have node_modules in your folder structure.
Use the following commands :
npm install -g grunt-cli
npm install --save
bower install --save
This should do the trick.
Upvotes: 1
Reputation: 41
This usually appears if you don't have grunt installed. Also you should install bower if you don't have it.
Try to install grunt like so : npm install -g grunt-cli
. Also you should run in you're project file npm install && bower install
to download all the dependencies that you need in you're project. I hope it helped.
Upvotes: 4