在Elastic Beanstalk上安装nvm

时间:2017-11-28 17:37:40

标签: node.js amazon-web-services elastic-beanstalk

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

In [80]: mapping = pd.Series(goals, index=df.month.unique())

In [81]: mapping
Out[81]:
1    1346
2    4456
3    4574
dtype: int64

In [82]: df['goals'] = df.month.map(mapping)

In [83]: df
Out[83]:
   month  staff  sales  goals
0      1      2   2183   1346
1      1      4   2235   1346
2      2      3   6123   4456
3      3      4   4213   4574

我收到错误

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"

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

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

我注意到,这个问题过去至少吸引了一些观众。我可以使用以下命令来做到这一点。

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

可能是一些名字不正确的命令,但我希望这对某些人有帮助!