运行vite+vue3项目时报错:
failed to load config from …/vite.config.ts error when starting dev server: Error: Cannot find module ‘node:path’ Require stack: /Users/list/Downloads/Admin-master/node_modules/vite/dist/node-cjs/publicUtils.cjs
百度了发现是node版本不够,于是去升级node到16版本
1.清除npm缓存:
npm cache clean -f
2.安装node版本管理工具n:
npm install n -g 或 sudo npm install n -g
3.查看所有node版本:
npm view node versions
4.指定安装版本:
n 16.0.0
这里提示not found 是因为在安装管理工具时没有权限,需要在命令的前面加上sudo,如sudo n 16.0.0,然后出现以下就是安装正确 5.也可以升级到最新的稳定版本:
sudo n stable
然后去启动项目:npm run dev 启动成功
发表评论