问题
When installing fresh Laravel 8.1 with livewire when in CLI i run npm run dev i got this i m new so please help me out?
> 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)
Error
回答1:
Just try to upgrade your current node version
current stable 15.5.1
you can upgrade it using brew in mac os case:
brew install nvm
nvm install 15
nvm use 15
回答2:
Need to update node version.
Ubuntu (Linux)
Run this command to update node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
after this close current terminal and open new one and run this command in PROJECT DIR
sudo npm install
npm run dev
来源:https://stackoverflow.com/questions/65653570/laravel-8-fresh-installation-with-livewire-npm-install-npm-run-dev-error