oklas/react-app-alias

Error: Cannot find module 'react-scripts/config/paths'

Tbaut opened this issue · 3 comments

Tbaut commented

Hello and thank you so much for this great lib.
I have troubled using it with craco, after following the craco config, and launching the app with craco start I get:

yarn run v1.22.10
$ /home/user/app/node_modules/.bin/craco start
(node:18131) UnhandledPromiseRejectionWarning: Error: Cannot find module 'react-scripts/config/paths'
Require stack:
- /home/user/app/node_modules/react-app-rewire-alias/src/index.js
- /home/user/app/packages/files-ui/craco.config.js
- /home/user/app/node_modules/@craco/craco/lib/config.js
- /home/user/app/node_modules/@craco/craco/scripts/start.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/user/app/node_modules/react-app-rewire-alias/src/index.js:4:15)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
(node:18131) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:18131) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 0.18s.

Any idea? Thanks a lot.

oklas commented

Hello, this is a dependency issue, create-react-app builds app that uses react-scripts. Check that react-scripts exists in node_modules and check that path config/paths exists in it (clarify version react-scripts). As an option reinstall all (rm -rf node_modules && yarn)

Tbaut commented

Thanks for your quick answer. I had a fresh install, with fresh node_modules and yarn.lock. The problem persisted unfortunately (with react-scripts v3.4.4). Closing as I'll go another route with craco and won't be able to report back.

oklas commented

Thank for feedback. The file (mentioned in error above) exists in current v4.0.1 and in previous v3.4.4 versions of react-scripts. If anyone else expirenced this issue - feel free to reopen or create new issue with example to reproduce.