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

Errors after dependency upgrades #26

Closed
yokelpole opened this issue Mar 15, 2019 · 8 comments
Closed

Errors after dependency upgrades #26

yokelpole opened this issue Mar 15, 2019 · 8 comments

Comments

@yokelpole
Copy link
Contributor

After #25 was merged I've noticed issues with serverside renders on my application - mainly they do not work correctly when I use react-easy-crop due to a require statement seeking a dependency that is not immediately available.

This is the stacktrace for my error:

 Error: Cannot find module '@emotion/styled-base'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.wrappedResolveFilename [as _resolveFilename] (/data/fe/shared/node_modules/newrelic/lib/shimmer.js:358:39)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Function.wrappedLoad [as _load] (/data/fe/shared/node_modules/newrelic/lib/shimmer.js:364:38)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/data/fe/shared/node_modules/react-easy-crop/dist/styles.js:8:42)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.wrappedLoad [as _load] (/data/fe/shared/node_modules/newrelic/lib/shimmer.js:364:38)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/data/fe/shared/node_modules/react-easy-crop/dist/index.js:12:15)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.wrappedLoad [as _load] (/data/fe/shared/node_modules/newrelic/lib/shimmer.js:364:38)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/data/fe/releases/20190314231140/rendr-fe/shared/react_components/Cropper.react.js:3:23)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.wrappedLoad [as _load] (/data/fe/shared/node_modules/newrelic/lib/shimmer.js:364:38)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/data/fe/releases/20190314231140/rendr-fe/apps/change/app/views/petitions/components/MultiImageUploader.react.js:5:17)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) code: 'MODULE_NOT_FOUND' }

This is caused by the fully compiled styles.js including the @emotion/styled-base dependency like this:

var _styledBase = _interopRequireDefault(require("@emotion/styled-base"));

This error can also be seen when trying to run the package in runkit: https://npm.runkit.com/react-easy-crop

@ValentinH
Copy link
Owner

Ouch! Sorry for this. I'll investigate ASAP 🏃

@ValentinH
Copy link
Owner

I've published 1.8.3 that should fix your issue. Could you try it and let me know please? 🙂

@ValentinH
Copy link
Owner

BTW I'm not sure why it was not working in your app because @emotion/styled-base is a dependency of @emotion/styled which is a dependency of react-easy-crop: you should have @emotion/styled-base in your node_modules.

@yokelpole
Copy link
Contributor Author

Yeah, I'm a little confused as to why it wasn't working properly in the app since it is a dependency. It worked for client-side navigation but not serverside renders. I figured it was a wider issue as it wasn't working properly in runkit either.

When I was looking at the layout of my project's node_modules folder I saw that the @emotion folder only had styled and core in it. Since styled-base is a dependency of styled it was located within the node_modules folder belonging to styled and therefore unaccessible to the rest of the app. I probably could have added @emotion-styled-base to my package.json but I figured it'd be better to fix it at the module level.

The good news is that 1.8.3 fixes the problem! Thanks for the speedy fix, I really appreciate it!

@ValentinH
Copy link
Owner

Are you using npm or yarn?

When installing, the package with yarn, I get styled-base directly in the node_modules/@emotion folder. 🤔

@yokelpole
Copy link
Contributor Author

Ah, we do use npm so that seems likely as to why you weren't seeing the issue. I assume that npm.runkit.com uses npm as well, so that could be why it was happening there too.

I'll mark this as closed since the issue seems to be resolved.

@ValentinH
Copy link
Owner

Which version are you using?

@yokelpole
Copy link
Contributor Author

We're using npm 6.7.0 and node 10.15.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants