0
votes

Getting below in my react application. I have tried reinstallation of node_module, setting environment variable C:\Windows\System32

{
  "name": "my_app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "bootstrap": "^4.5.2",
    "bootstrap-social": "^5.1.1",
    "font-awesome": "^4.7.0",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-popper": "^2.2.3",
    "react-redux": "^7.2.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "3.4.1",
    "reactstrap": "^8.5.1",
    "redux": "^4.0.5"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
  "devDependencies": {
    "@babel/core": "^7.4.0",
    "@babel/preset-env": "^7.4.2",
    "@babel/preset-react": "^7.0.0",
    "babel-loader": "^8.0.5",
    "css-loader": "^2.1.1",
    "html-loader": "^0.5.5",
    "html-webpack-plugin": "^3.2.0",
    "lite-server": "^2.5.4",
    "react": "^16.8.5",
    "react-dom": "^16.8.5",
    "style-loader": "^0.23.1",
    "webpack": "^4.42.0",
    "webpack-cli": "^3.3.0",
    "webpack-dev-server": "^3.2.1"
  }
}

this.htmlWebpackPlugin.getHooks is not a function npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] start: react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] start 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! C:\Users\User\AppData\Roaming\npm-cache_logs\2020-08-13T02_51_42_849Z-debug.log

1
Did you also delete the package-lock.json file before reinstalling or try all of the steps in this post?jason_r

1 Answers

1
votes

This happens sometimes when there are some files cached. You can follow the following steps to solve it:

  1. Clear the cache. We use the --force flag to do it forcefully.

    $ npm cache clean --force

  2. Delete the node_modules folder and package-lock.json file. You could do that by navigating to the project folder or using the following command:

    $ rm -rf node_modules && rm package-lock.json

NOTE: Be very careful using the -rf command in the linux based terminal. Make sure you are in the right directory to use this command.

In Windows: $ rm -r "node_modules" in the powershell.

  1. Install the node dependecies

    $ npm install

This should solve the problem for you. If it still persist, then see what the error in the console says and try to solve that. It might be due to some other reason. :)