0

I'm trying to follow along with this fullstack React tutorial: https://www.youtube.com/watch?v=RDV3Z1KCBvo&t=2579s&ab_channel=CleverProgrammer

I haven't gotten far because every time I shut down my laptop and open the project again, npm start throws a weird error. I restarted the entire project from scratch because it kept throwing an error about the semver module being messed up. Now it's throwing a similar error:

internal/modules/cjs/loader.js:311
      throw err;
      ^

Error: Cannot find module '/Users/jaredb96/Documents/Projects/ReactProjects/amazon-clone/node_modules/webpack-manifest-plugin/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:303:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:516:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/jaredb96/Documents/Projects/ReactProjects/amazon-clone/node_modules/react-scripts/config/webpack.config.js:23:24)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32) {
  code: 'MODULE_NOT_FOUND',
  path: '/Users/jaredb96/Documents/Projects/ReactProjects/amazon-clone/node_modules/webpack-manifest-plugin/package.json',
  requestPath: 'webpack-manifest-plugin'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! amazon-clone@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the amazon-clone@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

So this time, the issue isn't semver but webpack. I'm not sure what to do, I've been reinstalling node and npm to no avail. I have another project that I started in a similar way but npm start works flawlessly with it, even after shutting things down.

Here's my package.json

{
  "name": "amazon-clone",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.11.2",
    "@material-ui/icons": "^4.11.2",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-scripts": "4.0.1",
    "web-vitals": "^0.2.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"
    ]
  }
}
lawrence-witt
  • 8,094
  • 3
  • 13
  • 32
weirdboy
  • 13
  • 3

1 Answers1

0

The correct thing to do was delete my package-lock.json, delete the node_modules, run npm cache clean --force then run npm install. Got part of the solution from the comments, part from here: error: This is probably not a problem with npm. There is likely additional logging output above

weirdboy
  • 13
  • 3