解决 Vite (Only file and data URLs are supported by the default ESM loader. Received protocol ‘node:‘)
解决 Vite (Only file and data URLs are supported by the default ESM loader. Received protocol ‘node:‘)
·
1、vite 初始化项目报错:Only file and data URLs are supported by the default ESM loader. Received protocol ‘node:‘
2、通过yarn方式看到具体错误:需要升级node
3、安装nvm管理node
Releases · coreybutler/nvm-windows · GitHub
解压 —> exe安装 —>选择node路径
https://github.com/coreybutler/nvm-windows/releases/download/1.1.9/nvm-setup.zip
4、nvm安装node+版本
4.1 修改nvm 源:nvm/settings.txt
root: ..\AppData\Roaming\nvm
path: ..\nodejs
arch: 64
proxy: none
node_mirror: http://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
nvm install 14.20.0
5、nvm use 版本报错
需 cmd 管理员打开,执行 nvm use 14.20.0
6、node切换源(国内淘宝镜像源)
npm config set registry https://registry.npm.taobao.org
npm config set registry https://registry.npmjs.org (原官方镜像源)
node -v
npm -v
npm init vite@latest main-app --template vue-ts
更多推荐
已为社区贡献2条内容
所有评论(0)