echo "echo sourcing && source ~/.nvm/nvm.sh" >> ~/.bashrc
export NVM_DIR="/home/ubuntu/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm echo sourcing && source ~/.nvm/nvm.sh source ~/.nvm/nvm.sh export PATH="$HOME/.yarn/bin:$PATH" export PATH=/home/ubuntu/.yarn/bin:/usr/local/sbin:/usr/local/bin$
.ssh/authorized_keys, it's not too hard to run that one other line to install nvm
Hey guys! I hope to find some help here even though this room didn't seem to have much life in last 5 months or so :) I'm trying to run a node script on a service startup (Ubuntu 12.04): it's been running alright this way before I started using nvm:
exec sudo -u strider <script>
Unfortunately, it seems that $PATH is the one of a root user when the command is run like this meaning that bash sees neither the script nor the node executable.
I feel so stupid right now, as it seems like an issue that must've already been solved so many times, but I still can't get it working as well finding anything helpful on the matter. Maybe someone can point me at how it can be done?
bash -l -c 'source ~/.nvm/nvm.sh; nvm install; npm install; npm run build'
@charginghawk I am using this currently in my dockerfile:<code> ENV NVM_DIR /root/.nvm
ENV NODE_VERSION 8
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash \
&& source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default \
&& npm install http-server </code>
nvm ls | grep -e 'default -> v8.9.3'
v8.9.3set as the default right now)
➜ nvm ls v8.9.3 default -> v8.9.3 node -> stable (-> v8.9.3) (default) stable -> 8.9 (-> v8.9.3) (default) iojs -> N/A (default) lts/* -> lts/carbon (-> v8.9.3) lts/argon -> v4.8.7 (-> N/A) lts/boron -> v6.12.2 (-> N/A) lts/carbon -> v8.9.3
TERM=dumb nvm alias default