Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTyler Phelps
Courses Plus Student 31 PointsMy command prompt doesn't recognize 'grunt' as a command.
I got up too 00:30:57 when he actually ran grunt to uglify his js files. In my command prompt I typed grunt in my project directory and it says: "'grunt' is not recognized as a internal or external command, operable program or batch file."
So what is this indicative of? Where did I go wrong. I'm completely new to this and trying to figure it out.
gruntfile.js module.exports = function(grunt) {
// Configure task(s)
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
build: {
src: 'src/js/*.js',
dest: 'js/script.min.js'
}
}
});
// Load the plugins
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
// Register task(s).
grunt.registerTask('default', [ 'uglify:build' ]);
};
In my project folder I have a src/js folder with a *.js file inside. I have a a js folder also. Let me know if there's any other info needed.
2 Answers
Joseph Frazer
5,404 PointsMake sure you installed grunt globally so it is in your path.
npm install -g grunt-cli
Scott LaPlant
Courses Plus Student 304 PointsYou may want to open a new shell. Try closing your current shell and open a new one and see if that fixes your issue. If not, it's most likely a path issue. What do you see when you run: echo $PATH ?
Tyler Phelps
Courses Plus Student 31 PointsTyler Phelps
Courses Plus Student 31 PointsI did that. Wrote down all the commands I wrote and that was one of the first ones. Could I run it again after the fact? But that would explain why typing in grunt should work.
Commands I used after npm install -g grunt-cli
npm init
npm install grunt --save-dev
npm install grunt-contrib-uglify --save-dev