广州鸿名健康科技有限公司


在linux中使用包管理器安装node.js

网络编程 在linux中使用包管理器安装node.js 06-22

网上文章中,在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

以上就是本文的全部内容了,希望大家能够喜欢。

node.js [superAgent] 请求使用示例
post请求:request.post('/api/pet').end(function(resp,err){if(resp.body.status===200){alert('yaygot'+JSON.stringify(res.body));}else{returnnext(resp.body);}});get请求:request.get('/api/pet')...}

运行Node.js的IIS扩展iisnode安装配置笔记
今年年初打算用Node.js基于Express框架重写博客程序,从此告别ASP.NET。然而,我目前用的VPS是WindowsServer系统、IIS服务器,如果让Express和IIS都监听80端口,

Node.js 学习笔记之简介、安装及配置
简单的说Node.js就是运行在服务端的JavaScript。Node.js是一个基于ChromeJavaScript运行时建立的一个平台。Node.js是一个事件驱动I/O服务端JavaScript环境,基于Googl


编辑:广州鸿名健康科技有限公司

标签:命令,还需要,是一个,是在,组件