0

I am building an e-comm-site clone with react and it was working perfectly fine until I added a 'StateProvider.js', 'reducer.js' and updated my 'index.js' to have my <App /> wrapped like so: <StateProvider initialState={initialState} reducer={reducer}> <App /> </StateProvider>. Now when I run 'npm start' it says:

node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module 'ajv-formats' Require stack:

  • /Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/node_modules/schema-utils/dist/validate.js
  • /Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/node_modules/schema-utils/dist/index.js
  • /Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/lib/Server.js
  • /Users/Desktop/E-Comm-Site/e-comm-site/node_modules/react-scripts/scripts/start.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/node_modules/schema-utils/dist/validate.js:25:20) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/node_modules/schema-utils/dist/validate.js', '/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/node_modules/schema-utils/dist/index.js', '/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/webpack-dev-server/lib/Server.js', '/Users/Desktop/E-Comm-Site/e-comm-site/node_modules/react-scripts/scripts/start.js' ] }.

The code is identical to that of the course I am following and it works still for them at this stage. Although he has serviceWork.js and I have reportWebVitals.js. Although I can't see how that would be the issue as it was working fine before?

2 Answers 2

2

Run the npm install from the root of the project directory command in your terminal.

If the problem persists after running that and restarting your server, the dependency ajv-formats is referenced by your project but not listed as a dependency in your package.json file. Tou can do this by running the command npm install ajv-formats --save

Sign up to request clarification or add additional context in comments.

Comments

2

I had the same issue. I removed node_modules and package-lock.json and did npm install and the error has gone

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.