当前位置:   article > 正文

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! jeeplus-ui@1.6.3 dev: `vite` npm ERR! Exit status_syntaxerror: unexpected reserved word at loader.mo

syntaxerror: unexpected reserved word at loader.modulestrategy (internal/mod

今天启动vue项目的时候报了这错误:

D:\workspace\ui>npm run dev
  • 1
> jeeplus-ui@1.6.3 dev D:\workspace\ui
> vite

file:///D:/workspace/ui/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:140:18)
    at async link (internal/modules/esm/module_job.js:42:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! jeeplus-ui@1.6.3 dev: `vite`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the jeeplus-ui@1.6.3 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\software\NodeJs\node_cache\_logs\2023-04-18T06_21_34_069Z-debug.log
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

查看是否安装成功:执行命令

vite -v
  • 1

如果没有安装就执行安装命令。

安装vite:

打开命令窗口,执行命令

npm install vite -g
  • 1

如果执行该命令报错:SyntaxError:Unexpected reserved word?,需要将nodejs升级至14及以上

先查看一下你本地的nodejs版本是多少:

node -v
  • 1

下载高版本的nodejs:

https://nodejs.org/download/release/v14.18.3/

下载完成以后,再执行:

npm install
npm run dev
  • 1
  • 2

就可以了,亲测可用。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/335692
推荐阅读
相关标签
  

闽ICP备14008679号