search

Home  >  Q&A  >  body text

node.js在centos上的安装不成功

我在腾讯云上申请了一个云主机.然后我用X-shell用root用户安装了node(用nvm安装的)可以使用.然后我在腾讯云的内置登陆上用root用户使用node,nvm.却说没有这些命令.这是为什么呢?
我已经在~/.bash_profile里添加了下面俩句话

export NVM_DIR="/Users/YOURUSERNAME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm
ringa_leeringa_lee2786 days ago338

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-04-17 15:39:59

    The nvm problem seems to be caused by environment variables. After logging out, the user variables are gone.
    I’ll give you a shell, I’ve always used it in centos

    #!/bin/bash
    export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
    git clone https://github.com/creationix/nvm.git ~/.nvm
    source ~/.nvm/nvm.sh
    nvm install 4.4.2

    Execute script

    chmod +x ./install.sh
    ./install.sh

    reply
    0
  • Cancelreply