Laravel 8 fresh installation with livewire npm install && npm run dev error

匆匆过客 提交于 2021-02-04 17:24:26

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!