1

My initial npm run dev (or watch or production) after a clean install of Laravel is being prematurely interrupted by a SyntaxError: Unexpected token = error message:

$ npm run dev

#@ watch /home/{...}/www-teste

   mix watch

[webpack-cli]
/home/{...}/www-teste/node_modules/laravel-mix/src/Mix.js:18
    static _primary = null;
                    ^

SyntaxError: Unexpected token =
    at new Script (vm.js:83:7)
    at NativeCompileCache._moduleCompile (/home/{...}/www-teste/node_modules/v8-compile-       
cache/v8-compile-cache.js:240:18)
    at Module._compile (/home/{...}/www-teste/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 (/home/{...}/www-teste/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at module.exports (/home/{...}/www-teste/node_modules/laravel-mix/setup/webpack.config.js:2:17)

Steps To Reproduce:

  1. laravel new www-teste (with or without --dev)
  2. cd www-teste
  3. npm install
  4. npm run {dev|watch|production}

Software versions:

  • Laravel Mix Version: 6.0.10 (npm list --depth=0)
  • Node Version (node -v): 6.0.10
  • NPM Version (npm -v): 6.0.10
  • OS: Ubuntu 20.04.1 LTS

How can I install a clean version of Laravel and enable Laravel-mix?

1
  • I would definitely imagine this is down to your node version. Node 6 hit EOL April 2019 github.com/nodejs/Release. Commented Jan 21, 2021 at 13:30

1 Answer 1

1

I also had problems lately with Laravel-mix in Ubuntu and I solved it by updating the NodeJS version.

Here are the commands to update NodeJS to the latest version 13.x in Ubuntu:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.