Install a node workstation with nvm
1 NVM
1.1 Install nvm
Note: Get the latest command from https://github.com/creationix/nvm
$> curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.9/install.sh | bash
$> export NVM_DIR="$HOME/.nvm" $> [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
1.2 Verify it has installed
$> command -v nvm
If not, check out the homepage for updated instructions
https://github.com/creationix/nvm#install-script
2. NPM init package.json
$> npm init
3A. Go with grunt
3A.1. If you had previously installed grunt globally, uninstall it
$> npm uninstall grunt -g
3A.2. Install grunt-cli globally
$> npm install grunt-cli -g
3A.3. Install grunt locally at a specific version
$> npm install grunt@0.4 --save-dev
3A.4 Install jshint
npm install grunt-contrib-jshint --save-dev
For documentation see : http://jshint.com/docs/options/
3A Troubleshoot
If upgrading from grunt 0.3 to 0.4, you need to remove the registerHelper functions, see:
http://stackoverflow.com/questions/14350759/gruntjs-0-4-registerhelper-deprecated-syntax-fix
Problem : Warning: Task "clean:dist" not found.
Solution
$> npm install load-grunt-tasks --save-dev
module.exports = function(grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
Problem : Warning: Task "less" not found.
Solution:
$> npm install grunt-contrib-less --save-dev
And nothing to add to your Gruntfile.js
Problem: Warning: Task "jst" not found.
Solution:
$> npm install grunt-contrib-jst --save-dev
And nothing to add to your Gruntfile.js
Problem: Warning: Task "requirejs" not found.
Solution:
$> npm install grunt-contrib-requirejs --save-dev
And nothing to add to your Gruntfile.js
Problem: Warning: Task "min" not found.
Solution:
$> npm install grunt-contrib-min --save-dev
In your Gruntfile.js change "min" to "uglify"
Problem: Warning: Task "mincss" not found.
Solution:
$> npm install grunt-contrib-cssmin --save-dev
Note: grunt-contrib-cssmin is recommended over grunt-contrib-mincss
And nothing to add to your Gruntfile.js
Problem: Warning: Task "concat" not found.
Solution:
$> npm install grunt-contrib-concat --save-dev
And nothing to add to your Gruntfile.js
Problem: requirejs : Missing either an "out" or "dir" config value. If using "appDir" for a full project optimization, use "dir". If you want to optimize to one file, use "out"
Solution: Put your options as follow inside Gruntfile.js
requirejs: {
compileProject: {
options : {
...
}
}
},
Recent Comments