Laravel8全新安装,带有livewirenpminstall&&npmrundev错误

当在 CLI 中使用 livewire 安装新的 Laravel 8.1 时,我运行 npm run dev 我得到了这个新的,所以请帮帮我?

> mix

[webpack-cli] /var/www/html/Am2/node_modules/laravel-mix/src/Mix.js:18
static _primary = null;
SyntaxError: Unexpected token =
at new Script (vm.js:83:7)
at NativeCompileCache._moduleCompile (/var/www/html/Am2/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
at Module._compile (/var/www/html/Am2/node_modules/v8-compile-cache/v8-compile-cache.js:184:36)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (/var/www/html/Am2/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at module.exports (/var/www/html/Am2/node_modules/laravel-mix/setup/webpack.config.js:2:17)

错误

回答

需要更新节点版本。

Ubuntu (Linux)

运行此命令以更新节点

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

在此关闭当前终端并打开新终端并在PROJECT DIR 中运行此命令之后

sudo npm install 
npm run dev


回答

只需尝试升级您当前的节点版本

当前稳定15.5.1

您可以在 Mac-OS 情况下使用 brew 升级它:

brew install nvm
nvm install 15
nvm use 15


以上是Laravel8全新安装,带有livewirenpminstall&&npmrundev错误的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>