close

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

How To Solve Laravel 8 fresh installation with livewire npm install && npm run dev error. Hello Guys, I have Installed Laravel Fresh Installation in my Environment With Laravel Livewire npm install And npm run dev through an error in my project.

So Here is I am Adding All Possible solution that I have tried to Solve This Error. Without Wasting your time, Let’s start this Article.

How This Error occurs ?

I have Installed fresh Laravel 8.1 Project with livewire. when in CLI I run npm run dev I got this Error In Terminal.

> 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)

How To Solve Laravel 8 fresh installation with livewire npm install && npm run dev Error ?

Question : How To Solve Laravel 8 Installation With LiveWire npm install & npm run dev error ?

Answer : You Are Facing This Error Cause Of NPM Version. You Just Have to Upgrade your NodeJS Version to Solve this Error. Just Follow the Below Command Line For Windows, Linux, And Mac To Upgrade your NodeJS version.

You Are Facing This Error Cause Of NodeJS Old Version Installed on your system. Just Upgrade Your NodeJs Version to Solve This Error.

Just Follow the Below Command Line For Windows, Linux, And Mac To Upgrade your NodeJS version.

How To Upgrade NodeJS Version For Windows User.

How To Upgrade NodeJS Version For Windows User ? Don’t Worry Just Follow Below All Step.

  1. Navigate to the Node.js website and click on the latest stable version or the newest current release (with the latest features) and download it.
  2. When the download is complete, run the installer.
  3. The Node.js Setup Wizard appears and guides you through the installation.
  4. Accept the License Agreement by checking the box and click Next.
  5. Choose the destination folder where you want to install Node.js.
  6. With that, the latest Node.js is ready to install. Click Install to confirm, wait until the installation completes, and click Finish.
  7. Check the Node.js version with the command:
node -v

How To Upgrade NodeJS Version For macOS User.

How To Upgrade NodeJS Version For macOS User ? Don’t Worry Just Follow Below All Step.

1. Before updating the Node.js release, check which version you are currently using with:

node -v

2. Next, clear npm cache with the command:

npm cache clean -f

3. Install n globally:

npm install -g n

4. Now that you have n installed, you can use the module to install the latest stable release of Node.js:

sudo n stable

Alternatively, you can install the Node.js release with the latest features:

sudo n latest

Or, install a specific version number with:

n [version.number]

How To Upgrade NodeJS Version For Linux User.

How To Upgrade NodeJS Version For Linux User ? Don’t Worry Just Follow Below All Step.

1. Start by updating the package repository with the command:

sudo apt update

2. Download the following dependencies by typing:

sudo apt install build-essential checkinstall libssl-dev

3. Install NVM using the curl command:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.1/install.sh | bash

4. Close and reopen the terminal.

5. Then, verify if you have successfully installed NVM:

nvm --version

6. Before upgrading Node.js, check which version you have running on the system:

nvm ls

7. Now you can check for newly available releases with:

nvm ls-remote

8. To install the latest version, use the nvm command with the specific Node.js version:

nvm install [version.number]

Summery

So it’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. And Also Comment on your suggestion here.

Also Read

Leave a Comment