The project uses npm run dev to appear Cannot find module 'node:fs'[nvm use]

The root problem is that the node version is not enough, so upgrade the node version to 16.18.1. However, there is already a node version on this machine, and it is very difficult to uninstall and install another one. So using nvm to manage node it can manage multiple node versions.

1. Install nvm

Installation package download address: https://github.com/coreybutler/nvm-windows/releases, windows system download nvm-setup.zip installation package,
insert image description here
followed by fool-style installation, and finally add two lines of code in settings.txt after installation.
insert image description here

node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

2. The use of nvm

nvm off                     // 禁用node.js版本管理(不卸载任何东西)
nvm on                      // 启用node.js版本管理
nvm install <version>       // 安装node.js的命名 version是版本号 例如:nvm install 8.12.0
nvm uninstall <version>     // 卸载node.js是的命令,卸载指定版本的nodejs,当安装失败时卸载使用
nvm ls                      // 显示所有安装的node.js版本
nvm list available          // 显示可以安装的所有node.js的版本
nvm use <version>           // 切换到使用指定的nodejs版本
nvm v                       // 显示nvm版本
nvm install stable          // 安装最新稳定版
node -v   //当前node版本
npm -v	  //当前npm版本

3. node installation

这篇博客介绍的很好:
https://blog.csdn.net/qq_42006801/article/details/124830995

Guess you like

Origin blog.csdn.net/weixin_46266624/article/details/130557392