zoukankan      html  css  js  c++  java
  • 在linux中使用包管理器安装node.js

    网上文章中,在linux下安装node.js都是使用源码编译,其实node的github上已经提供了各个系统下使用各自的包管理器(package manager)安装node.js的方法。

    1. 在Ubuntu中,使用如下命令:

    curl -sL https://deb.nodesource.com/setup | sudo bash -
    sudo apt-get install -y nodejs

    如果需要使用npm安装本地组件,还需要执行如下命令:

    apt-get install -y build-essential

    2. 在Debian中,使用如下命令:

    apt-get install curl
    curl -sL https://deb.nodesource.com/setup | bash -
    apt-get install -y nodejs

    如果需要使用npm安装本地组件,还需要执行如下命令:

    apt-get install -y build-essential

    3. 在RHEL、Fedora、CentOS中,使用如下命令:

    curl -sL https://rpm.nodesource.com/setup | bash -
    yum install -y nodejs

    如果需要使用npm安装本地组件,还需要执行如下命令:

    yum groupinstall 'Development Tools'
    #下面这行是在Fedora中执行的
    sudo yum install nodejs npm
    #下面这行是在RHEL和CentOS中执行的
    sudo yum install nodejs npm --enablerepo=epel

    不过实践中,在CentOS6中,执行 

    sudo yum install nodejs npm --enablerepo=epel

    会报错,而不执行,也可以使用npm。

    4. 在openSUSE和SLE中,使用如下命令:

    sudo zypper ar 
      http://download.opensuse.org/repositories/devel:/languages:/nodejs/openSUSE_13.1/ 
      Node.js
    sudo zypper in nodejs nodejs-devel

    5. 在Arch Linux中,使用如下命令:

    pacman -S nodejs

    6. 在FreeBSD和OpenBSD中,使用如下命令:

    /usr/ports/www/node
    cd /usr/ports/www/node-devel/ && make install clean
    #或者
    pkg_add -r node-devel
    pkg install node
    #或者
    pkg install node-devel

    原文地址:https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager。

  • 相关阅读:
    butterknife异常提示:attribute value must be constant
    SharedPreferences第一次使用后HashMap将常驻内存
    js获取元素的innerText属性为什么为空
    针对focus和blur的Dom事件触发顺序
    android中View的GONE和INVISIBLE的原理
    HTML中div以及span等元素获取焦点
    android MotionEvent获得当前位置
    IE10 透明背景的div无法遮罩
    jquery中.attr('value')和.val()的区别
    __proto__和protaotype的区分
  • 原文地址:https://www.cnblogs.com/matchless/p/4334426.html
Copyright © 2011-2022 走看看