AWS EC2 上手动安装nodejs

  • switch to root user after ssh login
sudo -s
  • Installed nvm in /opt/nvm
git clone https://github.com/creationix/nvm.git /opt/nvm
  • Created the directory /usr/local/nvm. This is where the downloads will go ($NVM_DIR)
mkdir /usr/local/nvm
  • Create the directory /usr/local/node. This is where the NPM global stuff will go:
mkdir /usr/local/node
  • Created a file called nvm.sh in /etc/profile.d with the following contents:
export NVM_DIR=/usr/local/nvm
source /opt/nvm/nvm.sh

export NPM_CONFIG_PREFIX=/usr/local/node
export PATH="/usr/local/node/bin:$PATH"
  • make nvm is available to me
source /etc/profile.d/nvm.sh
  • Re-login to a shell session, then set the default node version.
nvm install node
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容