Im new to development and im using Steven Foote's book "learning to program" im currently trying to finish a portion of the project that requires you to install Node.js and Grunt. I seem to be having a problem with installing grunt.. hope the following makes sense.
i Installed Node.js
now im moving towards installing NPM, but first i navigate to the directory:
/Users/MR/Desktop/kittenbook
then i execute the command npm
the command seems to execute correctly, based off the books output results. the next command i entered is, and receive the following error:
Mannys-MacBook-Pro:kittenbook mannyr$ ~/Desktop/kittenbook/ sudo npm install -g grunt-cli
-bash: /Users/MR/Desktop/kittenbook/: is a directory
so instead i'ved tried:
Mannys-MacBook-Pro:kittenbook mannyr$ sudo npm install -g grunt-cli
i receive the following output:
/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
[email protected] /usr/local/lib/node_modules/grunt-cli
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected])
here are my files:
GruntFile.js
module.exports = function(grunt){
// project configuration
grunt.initConfig({
concat:{
release: {
src: ['js/values.js', 'js/prompt.js'],
dest:'release/main.js'
}
},
copy: {
release: {
src: 'manifest.json',
dest: 'release/manifest.json'
}
},
jshint: {
files: ['js/values.js', 'js/prompt.js']
}
});
// we will load grunt plugins here
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
// we will register tasks here
grunt.registerTask('default', ['jshint', 'concat', 'copy']);
};
package.json
{
"name": "kittenbook",
"version": "0.0.1",
"devDependencies":{
"grunt":"~0.4.2",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-jshint": "~0.6.3",
"grunt-contrib-copy": "~0.5.0"
}
}
when i try running the following command i receive this issue:
Mannys-MacBook-Pro:kittenbook mannyr$ grunt jshint
Warning: Task "jshint" not found. Use --force to continue.
Aborted due to warnings.
According to the information you are giving, you only installed:
The error message you are getting is because the dependencies in your
package.json
are not installed:Go to the directory where
package.json
exist and runnpm install
. It will install these packages and then trygrunt jshint
. It is supposed to work.