Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 20:34
    JoshuaVSherman commented #1651
  • Jan 31 2019 20:32
    JoshuaVSherman commented #1651
  • Jan 31 2019 19:42
    bthompson90 commented #1994
  • Jan 30 2019 21:33
    anishmittal2020 commented #1994
  • Jan 29 2019 23:51
    ljharb commented #1994
  • Jan 29 2019 23:51
    anishmittal2020 commented #1994
  • Jan 29 2019 23:49
    anishmittal2020 commented #1994
  • Jan 29 2019 22:05
    Tbhesswebber closed #1997
  • Jan 29 2019 22:05
    Tbhesswebber commented #1997
  • Jan 29 2019 22:03
    ljharb commented #1997
  • Jan 29 2019 22:01
    Tbhesswebber edited #1997
  • Jan 29 2019 21:59
    Tbhesswebber opened #1997
  • Jan 29 2019 18:14
    ljharb labeled #1995
  • Jan 29 2019 18:14
    ljharb labeled #1995
  • Jan 29 2019 18:14
    ljharb labeled #1995
  • Jan 29 2019 18:14
    ljharb commented #1995
  • Jan 29 2019 12:40
    abhishek6262 edited #1996
  • Jan 29 2019 12:39
    abhishek6262 edited #1996
  • Jan 29 2019 12:39
    abhishek6262 opened #1996
  • Jan 29 2019 11:59
    promcoder commented #308
Varun Jayaraman
@varunjayaraman
for the 2nd set of commands
Jordan Harband
@ljharb
hm
Varun Jayaraman
@varunjayaraman
i still have to source it?
Jordan Harband
@ljharb
and you're certain bashrc is being sourced the 2nd time around?
Varun Jayaraman
@varunjayaraman
yeah i put an echo in there
Jordan Harband
@ljharb
try adding one of those "echo" statements inside your command list
instead of directly inside bashrc
the question is, is bashrc being sourced after you've modified it
Varun Jayaraman
@varunjayaraman
sorry im a bit confused
what do you want me to echo in the command list
oh you mean any echo, to see which runs first?
Jordan Harband
@ljharb
echo "echo sourcing && source ~/.nvm/nvm.sh" >> ~/.bashrc`
iow i want the thing you add to be "echo something and then source nvm"
so that you can see if the thing you added is being executed
Varun Jayaraman
@varunjayaraman
at the end of the 1st command list?
like where in the timeline do you want to see this echo
Jordan Harband
@ljharb
in that array
where you do your apt-get update and whatnot
Varun Jayaraman
@varunjayaraman
ok i put this command in the array
echo "echo sourcing && source ~/.nvm/nvm.sh" >> ~/.bashrc
that will add that stuff to .bashrc though
do you want to see it in the terminal or in .bashrc
anyway those echoes dont get executed
this is the bottom part of my 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$
(yarn is part of the 2nd script)
Jordan Harband
@ljharb
ok
if the "echo sourcing" isn't running tho then it's definitely not sourcing your .bashrc on every ssh
aha another hunch
your first ssh requests a login shell, but does your second?
it's like ssh -L or something, and you'd need it on every ssh command you run
(or at least on the last one)
Varun Jayaraman
@varunjayaraman
it should be whatever the npm library ssh2 requests
i'll look inside the source code
but i think i'm just gonna manually configure nvm
that's literally the only part breaking my entire script that allows me to configure my vm with a one-liner and i have to ssh in to configure the ssh keys in .ssh/authorized_keys, it's not too hard to run that one other line to install nvm
Jordan Harband
@ljharb
gotcha
Varun Jayaraman
@varunjayaraman
thanks for all the help though
Jordan Harband
@ljharb
np, good luck
glock18
@glock18

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?

Jordan Harband
@ljharb
@glock18 yes, nvm is per-user, so it's not compatible with sudo
so if you want root to have nvm, it needs its own installation of nvm, and your script probably will need to source nvm.sh
glock18
@glock18
@ljharb thank you for response. No, of course I don't want to run any of this as a root user. For now I'm gonna be passing right PATH to the command, which might be not-to-good of a solution, but at least it doesn't require shenanigans with multiple installations of nvm, node or whatnot.
Jordan Harband
@ljharb
@glock18 makes sense. ideally the script wouldn't need sudo at all tho :-)
Thomas M. Charging Hawk
@charginghawk
howdy
running nvm in a makefile in a docker container,
I've pieced together this command: bash -l -c 'source ~/.nvm/nvm.sh; nvm install; npm install; npm run build'
it gets the job done, but checking for glaring pitfalls my team might run into using this
Jordan Harband
@ljharb
@charginghawk you've now asked in 3 places :-) cross-posting doesn't help much. let's continue in #nvm on freenode.
Filip94
@Filip94
Hello everyone, i tryed the web, but was not able to find anything.
"Using nvm in a Makefile"
doable or no?