Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Module not found: Error: Can't resolve '/node_modules/html-webpack-plugin/lib/loader.js'

I'm a Java developer working on a react prototype and everything was going well until I installed Font Awesome and started getting this error saying Error: Can't resolve '/node_modules/html-webpack-plugin/lib/loader.js'. I've deleted the node_modules folder but the issue still persists. Most answers suggest me to upgrade my node version, which we cannot do to be able to run our other projects that only goes up to node 14. There are other answers talking about a webpack.config file. I didn't seem to have this file anywhere (even when I yarn install it). I've I've tried to manually add it with some of the suggested fixes but haven't noticed any difference.

enter image description here

enter image description here

{
  "name": "mandarinblueprint",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.2",
    "@testing-library/react": "^12.1.4",
    "@testing-library/user-event": "^13.5.0",
    "axios": "^0.26.1",
    "bootstrap": "^5.1.3",
    "react": "^17.0.2",
    "react-bootstrap": "^2.2.2",
    "react-dom": "^17.0.2",
    "react-scripts": "5.0.0",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "html-webpack-plugin": "^5.5.0"
  }
}

Thank you.

like image 830
Francislainy Campos Avatar asked Feb 04 '26 11:02

Francislainy Campos


1 Answers

I was told by a colleague about nvm and that it would allow us more easily change between node versions, so I've updated my terminal to use version 16 instead of 14 and that fixed the issue.

like image 64
Francislainy Campos Avatar answered Feb 06 '26 04:02

Francislainy Campos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!