webpack serve giving "Invalid regular expression" error

Viewed 14093
6 Answers

I'm having the same issue just today. I solve it with updating my node version to the latest stable version

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

I was running Node 8.9.1 instead of the latest stable version, which was causing the problems.

nvm install stable
nvm use stable

In my case (Node 12, Webpack 5.3.1), updating webpack-cli to 4.2.0 solved this error

I could not upgrade to the latest node because it would have forced me to upgrade my Angular sites. I used this command to fix the error:

npm install webpack@4.42.0 webpack-cli@3.3.11 webpack-dev-server@3.10.3 --save-dev

Basically it forces a version of webpack that does not have the error.

On Ubuntu I first removed node.js and reinstalled using snap, which solved it for me

sudo apt-get remove nodejs
sudo snap remove node
sudo snap install node --classic

I am facing the same problem, I swith the node version from 8.x to 16.x and fix it using this command:

[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/crx-selection-translate% nvm list
->      v8.17.0
       v10.24.1
       v16.13.0
        v17.2.0
         system
default -> 8 (-> v8.17.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v17.2.0) (default)
stable -> 17.2 (-> v17.2.0) (default)
lts/* -> lts/gallium (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0
lts/dubnium -> v10.24.1
lts/erbium -> v12.22.7 (-> N/A)
lts/fermium -> v14.18.2 (-> N/A)
lts/gallium -> v16.13.1 (-> N/A)
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/crx-selection-translate% nvm use 16
Now using node v16.13.0 (npm v8.1.0)

hope it help with others. The webpakc version "webpack": "^5.67.0".

Related