avatar

sunday

Sunday's Blog

  • 首页
Home linux ubuntu安装最新的nodejs版本
文章

linux ubuntu安装最新的nodejs版本

Posted 2024-01-27 Updated 2024-01- 27
By sunday
3~4 min read

服务器ubuntu22.04上安装nodejs稳定版本

1.执行安装脚本

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - 

sudo apt-get install -y nodejs

其中setup_lts.x 可以改成你想要安装的版本

比如18.x的最新的版本就执行

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -

其他安装具体可查看

https://github.com/nodesource/distributions

2.如需安装多个版本,可使用node管理工具nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

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

#安装稳定的最新版本
nvm install --lts


#安装18.x最新版本
nvm install 18

具体可看:

https://github.com/nvm-sh/nvm

软件安装, nodejs, 软件使用
软件使用 ubuntu nodejs
License:  CC BY 4.0
Share

Further Reading

Dec 30, 2024

解决Windows无法安装到这个磁盘 选中的磁盘具有MBR分区表

1.在Windows安装界面,按下 Shift + F10 组合键,打开命令提示符。 2.执行以下命令 diskpart list disk select disk 0 clean convert gpt #转换成功继续执行 exit #退出diskpart 可以关掉窗口了

Oct 10, 2024

docker-compose安装n8n自动化工作流

1.docker-compose.yml文件配置 services: n8n: image: docker.n8n.io/n8nio/n8n container_name: n8n restart: unless-stopped ports: - "5

Jul 26, 2024

docker compose 安装部署 wordpress

1.docker compose 文件直接部署 按照官方部署教程可能会出现以下报错 No 'wp-config.php' found in /var/www/html, but 'WORDPRESS_...' variables supplied; copying 'wp-config-docker

OLDER

ubuntu22.04服务器内存不足,如何临时解决,启用交换内存

NEWER

docker-compose安装chatwoot客户互动系统

Recently Updated

  • nextjs15使用better-sqlite3的连接报错问题
  • nextjs + clerk + supabase + realtime 实时监听数据库更改
  • 解决nextjs15使用useLocalStorage报错的问题
  • mac上使用nodejs appium控制chrome浏览器
  • 2024年终总结

Trending Tags

nginx acme 强制跳转HTTPS nodejs 代理 mac 神器 vue3 工具 docker

Contents

©2025 sunday. Some rights reserved.

Using the Halo theme Chirpy