服务器之家:专注于服务器技术及软件下载分享
分类导航

Linux|Centos|Ubuntu|系统进程|Fedora|注册表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服务器之家 - 服务器系统 - Linux - linux下安装nodejs的详细步骤

linux下安装nodejs的详细步骤

2022-01-20 17:35雪菜粥 Linux

本篇文章主要介绍了linux下安装nodejs的详细步骤,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

推荐方法:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// 下载nvm
$ git clone https://github.com/cnpm/nvm.git
 
// 安装你需要的版本,然后你就可以在任何目录下使用node以及npm了
$ nvm install 7.4.0
 
//新打开的窗口,如果无法实现,那么还需要下面两步
 // 1 配置终端启动时自动执行,在 ~/.bashrc, ~/.bash_profile, ~/.profile, 或者 ~/.zshrc 文件添加以下命令:(.profile中修改亲测有效)
 source ~/git/nvm/nvm.sh
source ~/.profile
 
// 设置默认运行的node版本
$ nvm alias default 0.12
 
// 验证 nvm ls 如果出现了default为7.4.0 表现安装成功,之后任意打开都可以实现node的使   用
 default -> 7.4.0 (-> v7.4.0)

其他方法:

1.编译包解压+配置变量

?
1
2
3
wget https://npm.taobao.org/mirrors/node/latest-v4.x/node-v4.4.7-linux-x64.tar.gz
tar -zxvf node-v4.4.7-linux-x64.tar.gz
export PATH=$PATH:/opt/node-v4.4.7-linux-x64/bin

2.源码包编译+安装+配置变量

3.apt-get安装

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。

原文链接:http://blog.csdn.net/marian96/article/details/72902168

延伸 · 阅读

精彩推荐