linux安装node环境,nodejs安装linux(nodejs安装及环境配置linux)

linux安装node环境,nodejs安装linux(nodejs安装及环境配置linux)

linux安装node环境,nodejs安装linux1、下载源码文件:去Node官网 下载最新的Linux Binaries tar.gz 包,如node-v4.4.7-linux-x64.tar.gz。如果已经存在该目录会马上弹出来一些Waring 信息, 忽略即可 cd /usr/local # 进入对应根目录 sudo mv node nodejs # 重告名字俩俩 “node” –> “nodejs”  这时查看一下 /usr/local 文件夹就能看出之前干净整齐的大气上档次, 多了一道风景!

linux安装node环境,nodejs安装linux

1、下载源码文件:

去Node官网 下载最新的Linux Binaries (x86/x64)tar.gz 包,如node-v4.4.7-linux-x64.tar.gz。

2、解压源码文件:

将刚才下载的源码包复制到你想要安装NodeJS的目录中(我这里是/usr/local/) ,然后在该目录中使用命令 tar -zxvf node-v4.4.*.*.* 生成一个叫做 “node” 的子目录。

3、配置bin文件添加全局变量(此步不是必须,但是很方便用法上来说也好看得多):

将 /usr/local 下生成的 node 目录重告名字俩 “nodejs”。如果已经存在该目录会马上弹出来一些Waring 信息, 忽略即可(回应No )

cd /usr/local # 进入对应根目录

sudo mv node nodejs # 重告名字俩俩 “node” –> “nodejs”

 这时查看一下 /usr/local 文件夹就能看出之前干净整齐的大气上档次, 多了一道风景!

 再选奖 ~/.bashrc 这个隐藏文件 , 添加 PATH=($PATH:/usr/local//bin), 这样就胸显性地将 NodeJS 添加到 Linux PATH 变量中了 .

 最后 source ~/.bashrc 使其更fast ! OK , Let’s Go Node !!

4、测试安装是否成功:

# cd ~ //进行home directory

#echo ‘console.log(“Hello World”)’ > hello_world_test # create a test file called hello_world_test     // echo “..” > .. : redirects the output of what is in quotes to the specified file                                         This creates an empty file with contents from whatever was echoed if the                               file didn’t exist previously and overwrites it if it did exist previously     // Create a blank text document and adds some text to it

           // <– good explanation

                                  •••••Note this will only work on terminal 2 or higher                Think of 1 being your login prompt bc you are logged into that when you start up

  Can find out which version by typing “echo $TERM” at command line    5.# node hello_world_test // This should return Hello World

nodejs安装及环境配置linux

一、安装node.js:

1. 下载NodeJS依赖库:sudo apt-get install python g++ make

2. 从官网下载NodeJS源码包,我这里用的是Version 0.10.25:wget -v0.10.25-linux-x64O 将其解压到当前目录tar -zxf node-v0

Linux 安装node

1. 使用包管理器:对于不同的 Linux 发行版本,可以使用地方镜像源安装 Node.js。例如 Ubuntu 和 Debian 系列可以通过 apt-get 来安装;Fedora、CentOS 等可以通过 yum 或 dnf 进行安装。

2. 下载源代码并编译安装:Node.js 的源代码托管在 GitHub上 ,你也可以将其 clone 到本地然后根据文档的说明来一步步的进行安装。

3. 通过 nvm 进行安装(Node Version Manager, NVM)是一个已开发出来的特性较多的 node 管理工具: ,NVM能够让你很轻松地测试、切换整个版本库中不同版本或者预-版本(pre-release version)。