Last active
July 13, 2022 14:24
-
-
Save simbo/24f50efbb1f941b65e07 to your computer and use it in GitHub Desktop.
setup node.js with nvm within vagrant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# add this to your provision.sh | |
# | |
# [!] run as 'vagrant' like this: | |
# su vagrant -c "source ${PROVISION_DIR}/provision-node.sh" | |
# | |
# [!] please keep the echo messages. those actions could take some more time without any output, so let the user know. | |
## | |
# install latest nvm | |
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags` | |
source ~/.nvm/nvm.sh | |
echo "source ~/.nvm/nvm.sh" >> ~/.bashrc | |
# install latest stable node.js | |
echo "Installing node.js... (please be patient)" | |
nvm install stable &> /dev/null | |
nvm alias default stable | |
# install global node packages | |
echo "Installing global node.js packages... (please be patient)" | |
# change 'gulp' to 'grunt' depending on project setup | |
npm install -g gulp bower npm-check-updates | |
# install project dependencies and build | |
cd /vagrant/ | |
echo "Installing local node.js packages... (please be patient)" | |
npm install | |
bower install | |
# see package.json for respective build task | |
npm run build-dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It can be simpler without having to create another script!