Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Can't resolve '../components/Overlay' on starting server #3041

Closed
axelson opened this Issue Sep 1, 2017 · 21 comments

Comments

Projects
None yet
@axelson
Copy link

commented Sep 1, 2017

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

I'm using yarn 0.27.5

Which terms did you search for in User Guide?

N/A

Environment

  1. node -v: v8.2.1
  2. npm -v: 5.3.0
  3. yarn --version (if you use Yarn): 0.27.5
  4. npm ls react-scripts (if you haven’t ejected): 1.0.12

Then, specify:

  1. Operating system: Mac OS X 10.12.6
  2. Browser and version (if relevant):

Steps to Reproduce

  1. run dotenv npm run start

Expected Behavior

Server starts running.

Actual Behavior

Receive the following error:

Failed to compile.

./node_modules/react-error-overlay/lib/containers/CompileErrorContainer.js
Module not found: Can't resolve '../components/Overlay' in '/Users/jason/nob/messages-frontend-prototype/node_modules/react-error-overlay/lib/containers'

Reproducible Demo

None at the moment.

Note: Downgrading to react-scripts 1.0.11 works great.

@gaearon

This comment has been minimized.

Copy link
Member

commented Sep 1, 2017

Can you run

rm -rf node_modules
npm i

and try again?

@axelson

This comment has been minimized.

Copy link
Author

commented Sep 1, 2017

@gaearon That does fix the issue. But yarn upgrade react-scripts should have worked fine right?

@emveeoh

This comment has been minimized.

Copy link

commented Sep 1, 2017

Also ran into this issue. Yarn install, then Yarn Start to launch Development Server. I have the same environment as the author and same error message.

Resolution:
Deleted the node_modules and the yarn.lock file. Yarn install, yarn start. Works perfectly now.

@gaearon

This comment has been minimized.

Copy link
Member

commented Sep 1, 2017

It's not working because the filename casing is different but OS probably didn't recognize that.
I think we can fix it.

@gaearon gaearon added the issue: bug label Sep 1, 2017

@gaearon gaearon added this to the 1.0.13 milestone Sep 1, 2017

@tharakawj

This comment has been minimized.

Copy link
Contributor

commented Sep 1, 2017

@gaearon you mean by renaming the file to old name?

@gaearon

This comment has been minimized.

Copy link
Member

commented Sep 1, 2017

The issue is because we replaced overlay.js with Overlay.js, and FS gets confused.
Let's just completely rename this file to something else. e.g. ErrorOverlay.js.

@himanshupathakpwd

This comment has been minimized.

Copy link

commented Sep 2, 2017

Do,
npm install
or
yarn install if you are using yarn

It solved problem on my system

gaearon added a commit that referenced this issue Sep 2, 2017

Changelog for 1.0.13
## 1.0.13 (September 2, 2017)

#### 🐛 Bug Fix

* `react-error-overlay`

  * [#3051](#3051) Fix case-sensitivity issue with upgrading the package version. ([@tharakawj](https://github.com/tharakawj))

* `react-dev-utils`

  * [#3049](#3049) Print filesize difference for chunks. ([@esturcke](https://github.com/esturcke))

* `react-scripts`

  * [#3046](#3046) Fix crash in development mode on IE11. ([@tharakawj](https://github.com/tharakawj))

#### 💅 Enhancement

* `react-scripts`

  * [#3033](#3033) Add an empty mock for `child_process` to let some libraries compile. ([@McFlurriez](https://github.com/McFlurriez))

#### 🏠 Internal

* `react-dev-utils`, `react-error-overlay`

  * [#3028](#3028) Make error overlay filename configurable. ([@jaredpalmer](https://github.com/jaredpalmer))

#### Committers: 4

- Anthony ([McFlurriez](https://github.com/McFlurriez))
- Erik J. Sturcke ([esturcke](https://github.com/esturcke))
- Jared Palmer ([jaredpalmer](https://github.com/jaredpalmer))
- Tharaka Wijebandara ([tharakawj](https://github.com/tharakawj))

### Migrating from 1.0.12 to 1.0.13

Inside any created project that has not been ejected, run:

```
npm install --save --save-exact react-scripts@1.0.13
```

or

```
yarn add --exact react-scripts@1.0.13
```

## 1.0.12 (August 28, 2017)

#### 🐛 Bug Fix

* `react-error-overlay`
  * [#3012](#3012) Fix module function name in error overlay. ([@gaearon](https://github.com/gaearon))

* `react-dev-utils`
  * [#2938](#2938) Remove superfluous lodash usage. ([@Timer](https://github.com/Timer))

#### 💅 Enhancement

* `react-scripts`

  * [#2917](#2917) Optimize the size of default favicon. ([@sylvainbaronnet](https://github.com/sylvainbaronnet))

#### 📝 Documentation

* `react-scripts`

  * [#2986](#2986) Docs: debugging in WebStorm. ([@prigara](https://github.com/prigara))
  * [#2948](#2948) Remove Modulus from user guide. ([@Zertz](https://github.com/Zertz))
  * [#2927](#2927) Update README.md. ([@tbassetto](https://github.com/tbassetto))

* `react-dev-utils`

  * [#2942](#2942) Fix docs for `printFileSizesAfterBuild`. ([@Kerumen](https://github.com/Kerumen))

#### 🏠 Internal

* `react-error-overlay`, `react-scripts`

  * [#2991](#2991) Update `babel-runtime` dependency ([@christophehurpeau](https://github.com/christophehurpeau))

* `react-dev-utils`, `react-error-overlay`, `react-scripts`

  * [#2515](#2515) Convert `react-error-overlay` to React ([@tharakawj](https://github.com/tharakawj))

#### Committers: 9

- Christophe Hurpeau ([christophehurpeau](https://github.com/christophehurpeau))
- Dan Abramov ([gaearon](https://github.com/gaearon))
- Ekaterina Prigara ([prigara](https://github.com/prigara))
- Joe Haddad ([Timer](https://github.com/Timer))
- Pier-Luc Gendreau ([Zertz](https://github.com/Zertz))
- Sylvain Baronnet ([sylvainbaronnet](https://github.com/sylvainbaronnet))
- Tharaka Wijebandara ([tharakawj](https://github.com/tharakawj))
- Thomas Bassetto ([tbassetto](https://github.com/tbassetto))
- Yann Pringault ([Kerumen](https://github.com/Kerumen))

### Migrating from 1.0.11 to 1.0.12

Inside any created project that has not been ejected, run:

```
npm install --save --save-exact react-scripts@1.0.12
```

or

```
yarn add --exact react-scripts@1.0.12
```

**Note:** there’s a [known issue](#3041) that might cause the project to not compile after upgrading. In this case, migrate straight to `1.0.13` which doesn’t have this issue.
@gaearon

This comment has been minimized.

Copy link
Member

commented Sep 2, 2017

This should be fixed in 1.0.13. Please verify.

https://github.com/facebookincubator/create-react-app/releases/tag/v1.0.13

@brandonmikeska

This comment has been minimized.

Copy link

commented Sep 3, 2017

I just upgraded to 1.0.13 and got this error when I copied and pasted yarn add --exact react-scripts@1.0.13 from the release notes.

I went back and ran yarn upgrade react-scripts and it fixed the issue.

@betoharres

This comment has been minimized.

Copy link

commented Sep 6, 2017

I was on 1.0.10 and then I ran yarn add --exact react-scripts@1.0.12 and yarn add --exact react-scripts@1.0.13
both of them gave me this error. I'm trying to reinstall all modules now

update: it works!

@gaearon

This comment has been minimized.

Copy link
Member

commented Sep 6, 2017

Yes, you'll still have the issue if you even try to upgrade to 12. That's why we recommend skipping it and going directly to 13.

But in any case removing node_modules and reinstalling will fix it.

@balazsorban44

This comment has been minimized.

Copy link

commented Sep 6, 2017

I just tried everything posted here, and nothing works! My project was ejected with react eject. Can it be a problem? I get this error at running yarn start:

module.js:471
    throw err;
    ^

Error: Cannot find module 'react-error-overlay/middleware'
    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> (/home/balazs/github/bibic-vendeghazak/config/webpackDevServer.config.js:3:32)
    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)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/balazs/github/bibic-vendeghazak/scripts/start.js:32:31)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at exports._errnoException (util.js:1020:11)
    at WriteWrap.afterWrite (net.js:800:14)
error Command failed with exit code 1.

@mxstbr mxstbr referenced this issue Sep 7, 2017

Merged

Server-side rendering #1394

14 of 14 tasks complete
@nicksarafa

This comment has been minimized.

Copy link

commented Sep 8, 2017

@balazsorban44 if you've already ejected perhaps try rolling back react-error-overlay to an older version.. "react-error-overlay": "^1.0.10" works for me

@gaearon

This comment has been minimized.

Copy link
Member

commented Sep 8, 2017

@balazsorban44 If you look closely at your error message, it is not the error message discussed in this thread. Please search issues for it—somebody already filed another issue about it. If you see this message it means you updated react-error-overlay to incompatible major version. Did you do this intentionally? It is expected that if you update packages to major versions, they will have breaking changes. Please don't update them if you haven't checked what changed.

@ankibalyan

This comment has been minimized.

Copy link

commented Oct 1, 2017

After upgrading to react@16.0 this issue arises to me as well.

@ankibalyan

This comment has been minimized.

Copy link

commented Oct 1, 2017


module.js:491
    throw err;
    ^

Error: Cannot find module 'react-error-overlay/middleware'
    at Function.Module._resolveFilename (module.js:489:15)
    at Function.Module._load (module.js:439:25)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/devserve/ankServe/walkOrder/admin-panel/config/webpackDevServer.config.js:3:32)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/devserve/ankServe/walkOrder/admin-panel/scripts/start.js:32:31)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! admin-panel@0.1.0 start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the admin-panel@0.1.0 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!     /home/devserve/.npm/_logs/2017-10-01T18_53_03_730Z-debug.log
@pfftdammitchris

This comment has been minimized.

Copy link

commented Oct 8, 2017

I had errors with react-error-overlay/middleware, I had upgraded them which caused errors.

My fix was to downgrade.

react-error-overlay to 1.0.9
react-hot-loader to 3.0.0-beta.7

Steps:
yarn remove react-error-overlay -D (remove from devDependencies)
yarn add react-error-overlay@1.0.9 -D

yarn remove react-hot-loader -D (remove from devDependencies)
yarn add react-hot-loader@3.0.0-beta.7

@deathmood

This comment has been minimized.

Copy link

commented Oct 10, 2017

Having same problems on

  • Windows 10 x64
  • node 8.5.0 and 8.6.0 (tried both)
  • npm 5.3.0
  • react-scripts 1.0.13 and 1.0.14 (tried both)
  • I did not eject app

(on macOS High Sierra works ok -- problems appears on Windows)

image

also

image

pls hlp!!!!

----- UPD

to everyone having same problem: when I thought I tried everything (reinstalling node, npm, packages) someone told me to restart windows and that worked ;)

@zslabs

This comment has been minimized.

Copy link

commented Oct 18, 2017

I've had something similar happening with a project attempting a react 16 upgrade - getting the following error:

./node_modules/react-error-overlay/node_modules/react-dom/lib/ReactMount.js
Module not found: Can't resolve 'react/lib/React' in '/Users/zach/Sites/rhinofront/node_modules/react-error-overlay/node_modules/react-dom/lib'

I've tried deleting node_modules and clearing npm cache without any luck.

Doing some research around that error (like this one) it looks like there might still be a 16 incompatibility with that module, but the package itself should support it just fine.

@huangsav

This comment has been minimized.

Copy link

commented Dec 6, 2017

I have the same error in "react-error-overlay": "^3.0.0" with React 16.2.0
image

@huangsav

This comment has been minimized.

Copy link

commented Dec 6, 2017

After I re-create the whole scripts is OK.

@facebook facebook locked and limited conversation to collaborators Dec 6, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.