今天安装laravel/breeze
套件时,运行npm run dev
命令遇到报错,错误详细代码如下:
UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token '??='
at Loader.moduleStrategy (internal/modules/esm/translators.js:145:18)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:8744) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
看了半天也不明白是啥意思,后来搜索了一下发现应该是nodejs
版本过低的问题,于是升级了一下nodejs
版本,从v14.17.6
升级到v20.12.1
。再次运行命令,成功执行,问题解决。