启动vue3报错不支持await import
按照官网的步骤先使用create-vue创建vue3项目,再执行npm run dev启动项目,发现报错:
PS D:\my-project> npm run dev
> my-project@0.0.0 dev D:\my-project
> vite
file:///D:/my-project/node_modules/vite/bin/vite.js:7
await import('source-map-support').then((r) => r.default.install())
SyntaxError: Unexpected reserved word
at Loader.moduleStrategy (internal/modules/esm/translators.js:122:18)
at async link (internal/modules/esm/module_job.js:42:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-project@0.0.0 dev: `vite`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-project@0.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additio
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ASUS\AppData\Roaming\npm-cache\_logs\2022-08-19T03_
原因是我使用的node是14.5.0版本,升级成16.16.0即可。