首页 > 编程语言 >nodejs 安装篇

nodejs 安装篇

时间:2022-11-07 11:13:01浏览次数:60  
标签:https nodejs sudo apt install nodesource 安装

  1. 直接使用ubuntu软件源安装

sudo apt update sudo apt install nodejs npm nodejs --version v10.19.0 npm -v

  1. 从nodesource安装nodejs和npm

复制代码

安装仓库

`https://github.com/nodesource/distributions
Installation instructions
Node.js v17.x:

Using Ubuntu

curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -
sudo apt-get install -y nodejs

Using Debian, as root

curl -fsSL https://deb.nodesource.com/setup_17.x | bash -
apt-get install -y nodejs
Node.js v16.x:

Using Ubuntu

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs

Using Debian, as root

curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
apt-get install -y nodejs
Node.js v14.x:

Using Ubuntu

curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs

Using Debian, as root

curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
apt-get install -y nodejs
Node.js v12.x:

Using Ubuntu

curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

Using Debian, as root

curl -fsSL https://deb.nodesource.com/setup_12.x | bash -
apt-get install -y nodejs
Node.js LTS (v16.x):

Using Ubuntu

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

Using Debian, as root

curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt-get install -y nodejs
Node.js Current (v17.x):

Using Ubuntu

curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs

Using Debian, as root

curl -fsSL https://deb.nodesource.com/setup_current.x | bash -
apt-get install -y nodejs
Optional: install build tools

To compile and install native addons from npm you may also need to install build tools:

use sudo on Ubuntu or run this as root on debian

apt-get install -y build-essential`

  1. nvm安装

`# 通过脚本安装
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

vim .bashrc

添加如下代码

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

保存退出后,执行下面命令让配置生效

source .bashrc
`

标签:https,nodejs,sudo,apt,install,nodesource,安装
From: https://www.cnblogs.com/cerofang/p/16865302.html

相关文章

  • 使用VS2019生成exe安装包
    1、安装工具包  2、在解决方案上右击,选择添加–>新建项目   3、查找setup模板,下一步并填写名称      4、进入文件系统设置主输出   ......
  • MySQL简易安装
    ** MySQL安装教程**本教程根据MySQL官方文档安装,过程简单,只适用于自己练习SQL,当做练习用。资源准备MySQL版本:mysql-8.0.31-linux-glibc2.12-x86_64.tar.xzLinux版本:cen......
  • windows10安装wsl的centos7版本,并启动ssh服务远程访问
    1.安装wsl的centos版本wsl是什么就不多说了,不清楚的自己去谷歌吧。也可以参考下面几篇文章:[https://learn.microsoft.com/zh-cn/windows/wsl/install-manual](microsoft......
  • docker安装kuboard
    目录一、kuboard安装二、域名、反向代理配置三、参考一、kuboard安装kuboard可以部署在kubernetes集群之上,也可以部署在集群之外。作为管理多集群的图形化工具建议部署在......
  • docker容器中安装vim
    1.进入容器dockerexec-it<容器名称/id>bash 2.进入apt-get配置目录cd/etc/apt 3.执行备份命令cpsources.listsources.list.bak 4.查看版本cat/etc/o......
  • 第2-1-3章 docker-compose安装FastDFS,实现文件存储服务
    目录4docker-compose安装FastDFS4.1docker-compose-fastdfs.yml4.2nginx.conf4.3storage.conf4.4测试4docker-compose安装FastDFS需要注意:network_mode必须是ho......
  • VS2022离线安装包
    # 下载visualstudio的在线安装包下载VisualStudioTools-免费安装Windows、Mac、Linux(microsoft.com) # 在适当的位置新建一个文件夹,我是放在桌面了C:\Use......
  • 史上最详细Docker安装Redis (含每一步的图解)实战
    不仅教你安装,还教你删除。每一行命令都带图解,绝对能懂。大家对搭建RedisClustr(Redis集群)感兴趣的,可以看看这篇文章Docker搭建RedisCluster集群环境希望对大家有所......
  • Debian 11 安装snap(snapd)之后使用apt(apt-get)安装软件报错"E:Sub-process /usr/bin
    1问题描述与分析为了安装notepad++,安装先安装了snap,貌似失败了,又安装了snapd,sudoaptinstallsnapd#sudoaptinstallsnap然后再用aptinstall时就报错:dpkg-dev......
  • Windows安装Mongodb
    Windows安装Mongodb官方文档:https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-windows-unattended/目前MongoDB官网已经不支持32位安装包的下载,由......