Instead of installing bower, gulp, ionic, cordova globally - I prefer to put them in the directory with the project. This way projects can have their own versions as needed.
You'll create a file env.sh
that lives at the root of your ionic project that
you'll source when you start working to ensure everything is setup properly.
I also like to lock my node version using @creationix's excellent nvm.
Install nvm per the instructions.
I find that setting the nvm directory in my .bash_profile slows down bash startup so I do that here and remove it from my profile. YMMV.
Create a file in the root of your ionic directory called env.sh that looks like the following:
# initialize nvm
export NVM_DIR="${HOME}/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
# add command here to use specific node version
nvm use 4.3.1
# add our local tools to our path
script_in_dir=path/to/project
export PATH=$PATH:$script_in_dir/node_modules/.bin
Be sure you've sourced your env with source env.sh
in your shell.
Now, to get gulp, ionic, cordova, etc locked to your directory, add the following to your package.json:
"devDependencies": {
"bower": "^1.3.3",
"gulp": "~3.9",
"ionic": "~1.2",
"cordova": "~5",
"gulp-util": "^2.2.14",
"shelljs": "^0.3.0"
},
And then just install your packages.
npm install
Now your tooling is local to this directory and not global.
Hi friend, see my template 👯 https://github.com/jdnichollsc/Ionic-Starter-Template