Webpack Error: SyntaxError: Unexpected token =

Getting the following error after npm run dev. I have already run npm install

This repo: craft-extension-inspirations/craft-extension-example at master · craftdocs/craft-extension-inspirations · GitHub

I also received this same error when trying to run dev on the template repos: GitHub - craftdocs/craft-extension-project-templates: Craft Extension Project Templates

It sounds like a configuration issue – I will follow up if I figure it out.

➜  craft-extension-example git:(master) ✗ npm run dev

> craft-extension-example@0.1.0 dev /Users/ian/Projects/craft-extension-inspirations/craft-extension-example
> webpack serve --mode=development

[webpack-cli] /Users/ian/Projects/craft-extension-inspirations/craft-extension-example/node_modules/webpack-dev-server/lib/servers/WebsocketServer.js:10
  static heartbeatInterval = 1000;
                           ^

SyntaxError: Unexpected token =
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    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 (internal/modules/cjs/helpers.js:25:18)
    at Server.getServerTransport (/Users/ian/Projects/craft-extension-inspirations/craft-extension-example/node_modules/webpack-dev-server/lib/Server.js:1049:28)
    at Server.createWebSocketServer (/Users/ian/Projects/craft-extension-inspirations/craft-extension-example/node_modules/webpack-dev-server/lib/Server.js:1612:38)
    at Server.start (/Users/ian/Projects/craft-extension-inspirations/craft-extension-example/node_modules/webpack-dev-server/lib/Server.js:2176:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! craft-extension-example@0.1.0 dev: `webpack serve --mode=development`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the craft-extension-example@0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ian/.npm/_logs/2021-12-03T01_33_22_923Z-debug.log

Figured it out, it was a versioning issue.

I was on node v10.18.1

Updating to the latest worked:

Now using node v14.17.5 (npm v6.14.14)