React-app-rewired: Cannot find module 'D:\xx\xx\xx/config-overrides'

Created on 7 Dec 2017  路  5Comments  路  Source: timarney/react-app-rewired

env
Node 7.5.0
os windows7 64
create-react-app 1.4.3
react-app-rewired 1.3.6

Even when I get into node_modules/react-app-rewired/index and fix path.configOverrides with '\', still gets the same error.

Most helpful comment

Fixed:

My mistake was to had added the config-overrides.js in src folder instead of the root folder.


Same happened to me on MacOS X High Sierra with

"react-app-rewire-yaml": "1.0.0",
"react-app-rewired": "1.5.0",

Logs:

npm test

> [email protected] test /Users/vadorequest/dev/student-loan-simulator
> react-app-rewired test --env=jsdom

module.js:471
    throw err;
    ^

Error: Cannot find module '/Users/vadorequest/dev/student-loan-simulator/config-overrides'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/vadorequest/dev/student-loan-simulator/node_modules/react-app-rewired/config-overrides.js:5:18)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
npm ERR! Test failed.  See above for more details.

Deleting/Reinstalling node modules didn't fix it.

All 5 comments

Please try remove node_modules and install it again.
I tried 1.3.6 on Windows 10 x64 and it worked fine.
If it still not works, please try to provide more details:
which command was run, detailed stack trace, etc

Fixed:

My mistake was to had added the config-overrides.js in src folder instead of the root folder.


Same happened to me on MacOS X High Sierra with

"react-app-rewire-yaml": "1.0.0",
"react-app-rewired": "1.5.0",

Logs:

npm test

> [email protected] test /Users/vadorequest/dev/student-loan-simulator
> react-app-rewired test --env=jsdom

module.js:471
    throw err;
    ^

Error: Cannot find module '/Users/vadorequest/dev/student-loan-simulator/config-overrides'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/vadorequest/dev/student-loan-simulator/node_modules/react-app-rewired/config-overrides.js:5:18)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
npm ERR! Test failed.  See above for more details.

Deleting/Reinstalling node modules didn't fix it.

@Vadorequest

It helps form me

https://github.com/timarney/react-app-rewired/blob/master/packages/react-app-rewired/config-overrides.js

add this "config-overrides-path": "node_modules/react-app-rewire-micro-frontends",
on package.json
and npm i react-app-rewire-micro-frontends

@robbiedh thx for your approach. However I have it improved:

npm i react-app-rewired

then:
on the top of your package.json add:

    "name": "my-app",
    "version": "0.1.0",
    "private": true,
    "config-overrides-path": "node_modules/react-app-rewired/config-overrides.js",
{...}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

001123 picture 001123  路  4Comments

srhise picture srhise  路  5Comments

huygn picture huygn  路  3Comments

Yegair picture Yegair  路  5Comments

zhihongzhong picture zhihongzhong  路  4Comments