create-vite-app vue3-camp创建项目失败,如何解决?
问题:在使用create-vite-app vue3-camp创建项目时失败,报错如下:/usr/local/lib/node_modules/create-vite-app/node_modules/fs-extra/lib/mkdirs/make-dir.js:85} catch {^SyntaxError: Unexpected token {at createScript (vm.js:8
·
问题:
在使用create-vite-app vue3-camp创建项目时失败,报错如下:
/usr/local/lib/node_modules/create-vite-app/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/create-vite-app/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
原因:
node版本过低导致;
解决方法:
更新node版本,我从v8.11.2 >> v12.19.0;
步骤
- node -v
(查看当前node版本)
- sudo npm cache clean -f
(回车后需要输入电脑登录密码)
- sudo npm install -g n
(n是node版本管理工具)
- sudo n stable
(更新到最新的稳定版node)
- node -v
(查看更新后node版本)
Tips
在执行步骤4时,碰到了下面这个问题,可能是因为网络vpn导致,把网络切换到手机热点,重新执行就成功了
QC:Downloads qc$ sudo n stable
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to nodejs.org:443
Error: failed to download version index (https://nodejs.org/dist/index.tab)
更多推荐
已为社区贡献1条内容
所有评论(0)