1

I am using node version 12.18.3 and create-react-app@3.4.1. When I create an app with npx command, npx create-react-app test-app, I face the following issue and the app is not getting generated,

Error: Cannot find module 'rxjs'
Require stack:
- /Users/arun/Desktop/my-work/test-app/node_modules/inquirer/lib/ui/prompt.js
- /Users/arun/Desktop/my-work/test-app/node_modules/inquirer/lib/inquirer.js
- /Users/arun/Desktop/my-work/test-app/node_modules/react-dev-utils/browsersHelper.js
- /Users/arun/Desktop/my-work/test-app/node_modules/react-scripts/scripts/init.js
- /Users/arun/Desktop/my-work/test-app/[eval]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/arun/Desktop/my-work/test-app/node_modules/inquirer/lib/ui/prompt.js:3:34)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/arun/Desktop/my-work/test-app/node_modules/inquirer/lib/ui/prompt.js',
    '/Users/arun/Desktop/my-work/test-app/node_modules/inquirer/lib/inquirer.js',
    '/Users/arun/Desktop/my-work/test-app/node_modules/react-dev-utils/browsersHelper.js',
    '/Users/arun/Desktop/my-work/test-app/node_modules/react-scripts/scripts/init.js',
    '/Users/arun/Desktop/my-work/test-app/[eval]'
  ]
}
  • I think this is related corrupted npm install, hope this link will be helful https://stackoverflow.com/questions/55994434/create-react-app-returns-cannot-find-module-rxjs – RRR Sep 12 '20 at 09:39
  • I tried CRA with --use-npm. I am not facing the above issue. I think it's related to my yarn package. Since CRA by default uses yarn to install dependencies, I suspect there could issues with my yarn version and CRA version. – ArunRavichandran Sep 12 '20 at 09:57

1 Answers1

0

This is caused by having moduleResolution set to anything other than node, or having skipLibCheck set to false in the tsconfig file. Ensure these two things are corrected and the error will go away.

TimCrooker
  • 101
  • 1
  • 5