创建vue3项目报错 升级node版本
今天使用vite创建vue3项目时报错,报错信息如下:
Vue.js - The Progressive JavaScript Framework
TypeError: (0 , import_node_util.parseArgs) is not a function
at init (C:\Users\yuyue\AppData\Local\npm-cache\_npx\2f7e7bff16d1c534\node_modules\create-vue\outfile.cjs:4481:72)
at Object.<anonymous> (C:\Users\yuyue\AppData\Local\npm-cache\_npx\2f7e7bff16d1c534\node_modules\create-vue\outfile.cjs:4862:1)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
看起来花里胡哨,于是我检查了node版本,我的版本是16+,查询了一下vite对于node版本的要求,最好是18+,于是使用了18版本的node成功创建
我这里使用的nvm
列出你已经安装的node版本: nvm ls
安装新版本: 例如 nvm install 18(安装你想要的版本可以是具体一点的)
切换新版本: nvm use 18