首页 > 编程语言 >前端开发 | Node 版本管理器选择

前端开发 | Node 版本管理器选择

时间:2024-07-01 20:31:59浏览次数:17  
标签:Node 管理器 install js 版本 fnm nvm 前端开发

一、Nvm

nvm 是一款 Node.js 版本管理工具,允许用户通过命令行快速安装、切换和管理不同的 Node.js 版本。

qkEJzb

nvm 只适用于 macOS 和 Linux 用户的项目,如果是 Windows 用户,可以使用 nvm-windowsnodistnvs 替换。

安装方式

macOS 下载方式:

brew install nvm
# or sh 命令
# 方式1 浏览器打开下面链接下载
https://github.com/nvm-sh/nvm/blob/v0.39.1/install.sh
# 下载完成后,通过命令安装
sh install.sh

# 方式2 推荐
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

# 方式3
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

安装过程中如果遇到一些奇怪的问题,可以查看下 nvm 补充说明。

常用命令

nvm ls                # 查看版本安装所有版本
nvm ls-remote         # 查看远程所有的 Node.js 版本
nvm install 17.0.0    # 安装指定的 Node.js 版本
nvm use 17.0.0        # 使用指定的 Node.js 版本
nvm alias default 17.0.0  # 设置默认 Node.js 版本
nvm alias dev 17.0.0  # 设置指定版本的别名,如将 17.0.0 版本别名设置为 dev

二、n

n 是一款交互式的 Node.js 版本管理工具,没有子脚本,没有配置文件,也没有复杂的 API,使用起来非常简单。

n 只适用于 macOS 和 Linux ,不适用于 Windows。

安装方式

可以使用 npm 直接安装到全局:

npm install n -g

常用命令

n          # 显示所有已下载版本
n 10.16.0  # 下载指定版本
n lts      # 查看远程所有 LTS Node.js 版本
n run 10.16.0 # 运行指定的 Node.js 版本

输入 n -h查看帮助信息,主要命令如下:

  n                              Display downloaded Node.js versions and install selection
  n latest                       Install the latest Node.js release (downloading if necessary)
  n lts                          Install the latest LTS Node.js release (downloading if necessary)
  n <version>                    Install Node.js <version> (downloading if necessary)
  n install <version>            Install Node.js <version> (downloading if necessary)
  n run <version> [args ...]     Execute downloaded Node.js <version> with [args ...]
  n which <version>              Output path for downloaded node <version>
  n exec <vers> <cmd> [args...]  Execute command with modified PATH, so downloaded node <version> and npm first
  n rm <version ...>             Remove the given downloaded version(s)
  n prune                        Remove all downloaded versions except the installed version
  n --latest                     Output the latest Node.js version available
  n --lts                        Output the latest LTS Node.js version available
  n ls                           Output downloaded versions
  n ls-remote [version]          Output matching versions available for download
  n uninstall                    Remove the installed Node.js

三、fnm

fnm 是一款快速简单

标签:Node,管理器,install,js,版本,fnm,nvm,前端开发
From: https://www.cnblogs.com/RioTian/p/18278783

相关文章

  • 苹果内购的凭证验证和解密(前端和本地node服务)
    苹果内购的凭证验证和解密最近在搞苹果内购,是使用微信提供的Dount提供的小程序转成APP。苹果内购使用的也是他们封装好的js接口,然后后端在解析我传递的支付凭证的时候他一直解析不成功然后我坚信自己的传递参数没有问题,我就自己使用node写了一个本地服务去验证我的支付凭证......
  • uni-app编译错误:“hasInjectionContext“ is not exported by “node_modules/.pnpm/p
    1.问题背景当我们接手一个新的uni-app项目(最头疼了x_x),可能会想到删掉node_modules和pnpm-lock.yaml后,执行npminstall或npminstall重新安装依赖包,然后执行pnpmdev:mp-weixin编译,但可能会遇到如下错误:"hasInjectionContext"isnotexportedby"node_modul......
  • 什么是 Python 包管理器?怎么安装?
    Python包管理器是一个用于安装、升级、卸载和管理Python包的工具。Python的包(也称为模块或库)是预编写的Python代码,用于执行各种任务,如数据处理、网页开发、科学计算等。Python包管理器使得这些包的管理变得简单和高效。在Python中,最常用的包管理器是pip(pipinsta......
  • AI引到学习前端开发
    假设你是一位前端技术开发专家,我有几个JavaScript的问题想向你咨询我想用JavaScript来做微信小程序开发,请以表格的方式输出知识要点请叙述JavaScript操作浏览器对象的常用接口和方法把上述表格按照访问对象归类将上述文字制作一个表格来呈现,要求逻辑清晰描述信息简明扼要且......
  • Electron | throw new Error('Electron failed to install correctly, please delete
    https://github.com/electron-vite问题原因在install的时候node_modules/electron/中的文件丢失造成程序无法执行解决方案要重新安装加载electron。这只是其中一个解决方案。参考https://github.com/pangxieju/electron-fix//1.npminstal//2.npminstall-gelectron......
  • 【JavaScript脚本宇宙】精通前端开发:六大热门CSS框架详解
    前端开发的利器:深入了解六大CSS框架前言在现代Web开发中,选择适合的前端框架和工具包是构建高效、响应式和美观的网站或应用程序的关键。本文将详细介绍六个广受欢迎的CSS框架:Bootstrap、Bulma、TailwindCSS、Foundation、Materialize和SemanticUI。每个框架都有其独特的......
  • Linux系统之部署linkding书签管理器
    Linux系统之部署linkding书签管理器一、linkding介绍1.1linkding简介1.2linkding特点二、本地环境介绍2.1本地环境规划2.2本次实践介绍三、检查本地环境3.1检查本地操作系统版本3.2检查系统内核版本四、部署Node.js环境4.1下载Node.js......
  • Node.js与ES632_Node.js入门
    一、什么是Node.js简单的说Node.js就是运行在服务端的JavaScript。Node.js是一个基于ChromeJavaScript运行时建立的一个平台。Node.js是一个事件驱动I/O服务端JavaScript环境,基于Google的V8引擎,V8引擎执行Javascript的速度非常快,性能非常好。二、Node.js安装1、下......
  • nodejs 统计算指定后缀,格式的文件
    都是gpt生成的 可用版本constfs=require('fs');constpath=require('path');functioncountHtmlFiles(dirPath){letcount=0;constfiles=fs.readdirSync(dirPath);files.forEach(file=>{constfilePath=path.join(dirPath,......
  • 使用fnm安装node,并自定义安装路径
    作者:咕魂时间:2024年6月23日本教程使用winget对fnm进行安装,主要分两部分,第一步安装fnm,第二步安装nodejs其中nodejs配置成功后只在powershell中生效1.fnm的安装假设我们自定义安装路径为:D:\fnm下载安装fnmwingetinstallSchniz.fnm--locationD:\fnm由于要从github上下......