Francislainy Campos
Francislainy Campos

Reputation: 4164

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.

Upvotes: 3

Views: 4434

Answers (1)

Francislainy Campos
Francislainy Campos

Reputation: 4164

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.

Upvotes: 1

Related Questions