Reputation: 8240
I am using Grunt as "JS Task Runner".
Node is installed in "C:/Program Files".
NPM got installed in C:/users/Peterson/appdata/roaming/npm.
Grunt, Bower, and Grunt-cli inside npm folder.
Creating a project - D:/Project A.
Following files inside D:/ProjectA - "package.json" and gruntfile.js
package.json
{
"name": "Test-Project",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-concat": "~0.1.3"
}
}
gruntfile.js
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
//Read the package.json (optional)
pkg: grunt.file.readJSON('package.json'),
// Metadata.
meta: {
basePath: '../',
srcPath: '../src/',
deployPath: '../deploy/'
},
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> ',
// Task configuration.
concat: {
options: {
stripBanners: true
},
dist: {
src: ['<%= meta.srcPath %>scripts/fileone.js', '<%= meta.srcPath %>scripts/filetwo.js'],
dest: '<%= meta.deployPath %>scripts/app.js'
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-concat');
// Default task
grunt.registerTask('default', ['concat']);
};
In CLI D:/ProjectA> grunt
Fatal Error: Unable to find local grunt
Can someone help?
Upvotes: 1
Views: 68
Reputation: 7902
You have installed node/npm and the clis of Grunt & Bower (installing them globally via npm install -g
I assume)
What you're missing is to run npm install
at the root of your project (where your package.json
file is), to install your project dependencies specified in the package.json
Upvotes: 2