0

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! my_app@0.1.0 start: react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the my_app@0.1.0 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

  • Did you also delete the `package-lock.json` file before reinstalling or try all of the steps in [this post](https://stackoverflow.com/a/49505612/8674094)? – jason_r Aug 13 '20 at 03:18

1 Answers1

1

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. :)

zmmsayeed
  • 21
  • 4
  • No its not working I have tried that the same error showed again to check console currently its not running at localhost. Please help me with that I am new to programming so it's difficult to solve this problem. – sakshi malik Aug 13 '20 at 08:57
  • After the third step could you also try installing this: ```npm i html-webpack-plugin@next``` Aslo CTRL + Shift + F and search for ```new InterpolateHtmlPlugin(env.raw)``` and change it to ```InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw)``` – zmmsayeed Aug 14 '20 at 09:23
  • @sakshimalik did you get a solutions? – zmmsayeed Aug 21 '20 at 01:24
  • I have other doubt if you help me with that https://stackoverflow.com/questions/63521612/create-react-native-app-is-not-recognized-as-an-internal-or-external-command/63523523#63523523 – sakshi malik Aug 22 '20 at 03:25