简体   繁体   中英

Installing nvm on Elastic Beanstalk

I'm trying to install nvm on my Elastic Beanstalk instance because our rails application requires node 6.9.5, currently node 4 exists on the instance. I'm running the commands

01_node_install:
    command: "sudo yum install make glibc-devel gcc patch openssl-devel c++"
02_node_install:
    command: "curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh"
03_node_install:
    command: "source ~/.bash_profile"
04_node_install:
    command: "nvm install 6.9.5"
05_node_install:
    command: "nvm alias default 6.9.5"

I am getting an error of

=> Profile not found. Tried ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile.
=> Create one of them and run this script again
OR
=> Append the following lines to the correct file yourself:

export NVM_DIR="/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm
=> Close and reopen your terminal to start using nvm

What's strange to me is that it's saying the file ~/.bash_profile does not exist but I can ssh into the instance and see it. I tried to echo the lines into the file but got similar errors.

Any help would be appreciated!

I noticed that this question has gotten at least some viewers over the past bit. I was able to do this with the following commands.

000_dd:
  command: echo “noswap”#dd if=/dev/zero of=/swapfile bs=1M count=3072
001_mkswap:
  command: echo “noswap”#mkswap /swapfile
002_swapon:
  command: echo “noswap”#swapon /swapfile
01-install-nvm:
  command: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
02-setup-bashrc:
  command: |
    cat << EOF >> /etc/bashrc
    export NVM_DIR="/.nvm"
    [ -s "\$NVM_DIR/nvm.sh" ] && \. "\$NVM_DIR/nvm.sh"  # This loads nvm
    [ -s "\$NVM_DIR/bash_completion" ] && \. "\$NVM_DIR/bash_completion"  # This loads nvm bash_completion
    EOF
03-install-node:
  command: source /etc/bashrc && nvm install 6.9.5
04-set-node-default:
  command: source /etc/bashrc && nvm alias default 6.9.5
05-set-node-default:
  command: source /etc/bashrc && ln -sf  $(nvm which 6.9.5) /usr/bin/node

Probably some poorly named commands but I hope this helps some people!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM