如何升级node版本?下面本篇文章给大家总结分享详细的升级教程,介绍一下Window、Mac或Linux系统下升级node版本的方法,希望对大家有所帮助!
Window 系统
- window系统升级node只能到node官网下载window安装包来覆盖之前的node。
- node 安装教程附下载地址:https://www.php.cn/link/f1c1c6a0b12ff7e656e875a7703535b7
- 因为 n 模块是不支持window系统:
PS C:\Users\liuxing> npm install -g n npm ERR! code EBADPLATFORM npm ERR! notsup Unsupported platform for n@9.0.0: wanted {"os":"!win32","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm ERR! notsup Valid OS: !win32 npm ERR! notsup Valid Arch: any npm ERR! notsup Actual OS: win32 npm ERR! notsup Actual Arch: x64 npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\liuxing\AppData\Roaming\npm-cache\_logs\2022-11-03T09_24_21_102Z-debug.log
Mac 或 Linux系统
1、升级方法:以下命令如果提示没权限,请在命令的前面加上sudo
,如sudo npm install n -g
【相关教程推荐:nodejs视频教程】
先清除npm缓存:
npm cache clean -f
安装node版本管理工具
n
;
npm install n -g
查看node 所有版本
npm view node versions
升级node版本
# 升级到指定的版本:n 版本号 n 16.0.0 # 升级到最新的稳定版本 n stable # 升级到最新版本,不推荐 n latest
使用node -v查看node版本,如果版本号改变为你想要的则升级成功。
node -v 16.0.0
2、如果版本号没变,可以重启机器或者尝试以下方法
查看通过n安装的node的位置
which node /usr/local/n/versions/node/16.0.0
进入该位置
cd /usr/local/n/versions/node
编辑
/etc/profile
vim /etc/profile
将node安装的路径,添加到文件末尾;
export NODE_HOME=/usr/local/n/versions/node/16.0.0 export PATH=$NODE_HOME/bin:$PATH
输入
wq
退出保存文件,再编译/etc/profile
;
source /etc/profile
重新查看版本号
node -v 16.0.0
更多node相关知识,请访问:nodejs 教程!
The above is the detailed content of How to upgrade node version? Detailed tutorial sharing. For more information, please follow other related articles on the PHP Chinese website!

node、nvm与npm的区别:1、nodejs是项目开发时所需要的代码库,nvm是nodejs版本管理工具,npm是nodejs包管理工具;2、nodejs能够使得javascript能够脱离浏览器运行,nvm能够管理nodejs和npm的版本,npm能够管理nodejs的第三方插件。

Vercel是什么?本篇文章带大家了解一下Vercel,并介绍一下在Vercel中部署 Node 服务的方法,希望对大家有所帮助!

node怎么爬取数据?下面本篇文章给大家分享一个node爬虫实例,聊聊利用node抓取小说章节的方法,希望对大家有所帮助!

node导出模块的两种方式:1、利用exports,该方法可以通过添加属性的方式导出,并且可以导出多个成员;2、利用“module.exports”,该方法可以直接通过为“module.exports”赋值的方式导出模块,只能导出单个成员。

安装node时会自动安装npm;npm是nodejs平台默认的包管理工具,新版本的nodejs已经集成了npm,所以npm会随同nodejs一起安装,安装完成后可以利用“npm -v”命令查看是否安装成功。

node中没有包含dom和bom;bom是指浏览器对象模型,bom是指文档对象模型,而node中采用ecmascript进行编码,并且没有浏览器也没有文档,是JavaScript运行在后端的环境平台,因此node中没有包含dom和bom。

本篇文章带大家聊聊Node.js中的path模块,介绍一下path的常见使用场景、执行机制,以及常用工具函数,希望对大家有所帮助!


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),