nvm安装及使用(windon/mac)
2024-09-08 17:20:52
有必要说一下nvm,因为大家做前端对node都很熟悉吧。前端的很多项目中都依赖node,还有可能每个项目依赖的node版本不一样,这样我们就上了nvm。
nvm 是node Version Manage的简称,顾名思义node版本管理器。
一、安装
安装包下载地址 https://github.com/coreybutler/nvm-windows/releases。选择nvm-setup .zip
下载完咔叽咔叽无脑下一步就行。
最后验证一下是否安装成功。打开终端 输入
nvm
出现一下内容证明已经安装成功了。
二、使用
查看可安装node版本:nvm list available
安装node命令: nvm install<version>
//例如我想安装 node 10.23.0 nvm install 10.23.0
查看以安装node版本:nvm list
带*的是当前使用node版本
切换node版本:nvm use <version>
以下是nvm的一些命令,在下英语0级就不翻译了,免得误人子弟。
1 nvm arch : Show if node is running in 32 or 64 bit mode.
2 nvm install <version> [arch] : The version can be a node.js version or "latest" for the latest stable version.
3 Optionally specify whether to install the 32 or 64 bit version (defaults to system arch).
4 Set [arch] to "all" to install 32 AND 64 bit versions.
5 Add --insecure to the end of this command to bypass SSL validation of the remote download server.
6 nvm list [available] : List the node.js installations. Type "available" at the end to see what can be installed. Aliased as ls.
7 nvm on : Enable node.js version management.
8 nvm off : Disable node.js version management.
9 nvm proxy [url] : Set a proxy to use for downloads. Leave [url] blank to see the current proxy.
10 Set [url] to "none" to remove the proxy.
11 nvm node_mirror [url] : Set the node mirror. Defaults to https://nodejs.org/dist/. Leave [url] blank to use default url.
12 nvm npm_mirror [url] : Set the npm mirror. Defaults to https://github.com/npm/cli/archive/. Leave [url] blank to default url.
13 nvm uninstall <version> : The version must be a specific version.
14 nvm use [version] [arch] : Switch to use the specified version. Optionally specify 32/64bit architecture.
15 nvm use <arch> will continue using the selected version, but switch to 32/64 bit mode.
16 nvm root [path] : Set the directory where nvm should store different versions of node.js.
17 If <path> is not set, the current root will be displayed.
18 nvm version : Displays the current running version of nvm for Windows. Aliased as v.
三、遇到的问题
值得注意的是:安装完nvm 之后 输入以下命令会出现错误
Could not retrieve https://nodejs.org/dist/latest/SHASUMS256.txt.
Get https://nodejs.org/dist/latest/SHASUMS256.txt: net/http: TLS handshake timeout
解决方案:
打开nvm安装目录找到到settings.txt 打开添加一下内容
node_mirror:npm.taobao.org/mirrors/node/
node_mirror:nom.taobao.org/mirrors/npm/
mac下下载不了node
解决方案: 直接去官网下载
例如10.23.0版本,node-v10.23.0-darwin-x64.tar.xz 点击下载。
然后放进/Users/用户名/.nvm/versions/node下然后以次命名
最新文章
- MySQL 启动原理剖析
- SignalR入门之多平台SignalR服务端
- 神奇的计算器dc和bc
- SpringMVC中使用Jcaptcha实现校验码验证
- [C# 基础知识系列]专题十六:Linq介绍
- Android 添加子视图(addView和setView)
- JVM启动过程——JVM之一
- HDU 3790 最短路径问题 (SPFA)
- 【UOJ #280】【UTR #2】题目难度提升
- tornado 增加日志模块
- win32 安装 xcache扩展
- 浅谈canvas绘画王者荣耀--雷达图
- pipeline结合GridSearchCV的一点小介绍
- java多线程的编程实例
- 算法与数据结构(六) 迪杰斯特拉算法的最短路径(Swift版)
- xml的作用
- oracle新建对象 权限管理
- how to check the computer is 32 bit or 64bit in linux
- dedecms首页去掉index.html怎么设置
- shell 查看去掉windons中的换行符