Laravel 8 全新安装,带有 livewire npm install && npm run dev 错误

ter*_*nao 13 laravel

当在 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)
Run Code Online (Sandbox Code Playgroud)

错误

Ter*_*nal 19

需要更新节点版本。

Ubuntu (Linux)

运行此命令以更新节点

sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Run Code Online (Sandbox Code Playgroud)

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

sudo npm install 
npm run dev
Run Code Online (Sandbox Code Playgroud)


小智 9

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

当前稳定15.5.1

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

brew install nvm
nvm install 15
nvm use 15
Run Code Online (Sandbox Code Playgroud)