Saidur Rahman
Saidur Rahman

Reputation: 24

Getting npm start error while creating a react app

I've created a react app, but I am struggling with a problem which it is caused in npm start. The error pops up whenever I use the command react-scripts start on my windows 7 32 bit OS.

(NOTE: I used npx create-react-app my-react to creatr the app)

Here is the error :


> [email protected] start D:\WEB DEVELOPMENT\MyReact\my-react
> react-scripts start

internal/modules/cjs/loader.js:628
  throw e;
  ^

Error: No valid exports main found for 'D:\WEB DEVELOPMENT\MyReact\my-react\node_modules\postcss-safe-parser\node_modules\postcss'
←[90m    at resolveExportsTarget (internal/modules/cjs/loader.js:625:9)←[39m
←[90m    at applyExports (internal/modules/cjs/loader.js:502:14)←[39m
←[90m    at resolveExports (internal/modules/cjs/loader.js:551:12)←[39m
←[90m    at Function.Module._findPath (internal/modules/cjs/loader.js:657:22)←[39m
←[90m    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:960:27)←[39m
←[90m    at Function.Module._load (internal/modules/cjs/loader.js:855:27)←[39m
←[90m    at Module.require (internal/modules/cjs/loader.js:1033:19)←[39m
←[90m    at require (internal/modules/cjs/helpers.js:72:18)←[39m
    at Object.<anonymous> (D:\WEB DEVELOPMENT\MyReact\my-react\node_modules\←[4mpostcss-safe-parser←[24m\lib\safe-parse.js:1:17)
←[90m    at Module._compile (internal/modules/cjs/loader.js:1144:30)←[39m {
  code: ←[32m'MODULE_NOT_FOUND'←[39m
}
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!     D:\ALL~FILE\APPS\Roaming\npm-cache\_logs\2021-03-20T16_33_30_649Z-debug.log ```

Upvotes: 0

Views: 1448

Answers (1)

Arnold Gee
Arnold Gee

Reputation: 896

You can try this:

  1. Delete node_modules folder
  2. Delete the package-lock.json file which is at the root of your repository
  3. Run these commands: npm install and then npm start

Explanation: It looks like some packages were installed incorrectly. These instructions will uninstall the various packages your react app needs to run propertly, and install them again.

Upvotes: 1

Related Questions