Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

laravel

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

like image 835
terinao Avatar asked Jan 10 '21 13:01

terinao


People also ask

How do I know if Livewire is installed?

Go to your composer. json and in require property you will see the livewire version like: { "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "require": { "livewire/livewire": "^2.5", ... }, ...

What is livewire in laravel 8?

Laravel Livewire is a library that makes it simple to build modern, reactive, dynamic interfaces using Laravel Blade as your templating language. This is a great stack to choose if you want to build an application that is dynamic and reactive but don't feel comfortable jumping into a full JavaScript framework like Vue.


Video Answer


2 Answers

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
like image 144
Parth kharecha Avatar answered Sep 28 '22 00:09

Parth kharecha


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
like image 36
Tikken Tikken Avatar answered Sep 28 '22 00:09

Tikken Tikken