繁体   English   中英

在Elastic Beanstalk上安装nvm

[英]Installing nvm on Elastic Beanstalk

我正在尝试在我的Elastic Beanstalk实例上安装nvm,因为我们的rails应用程序需要节点6.9.5,当前节点4存在于实例上。 我正在运行命令

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"

我收到了错误

=> 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

对我来说奇怪的是它说文件〜/ .bash_profile不存在但是我可以ssh到实例中看到它。 我试图将行回显到文件中但得到了类似的错误。

任何帮助,将不胜感激!

我注意到这个问题至少让一些观众过去了。 我可以使用以下命令执行此操作。

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

可能是一些命名不好的命令,但我希望这能帮助一些人!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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