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

Cannot resolve core-js #187

Closed
donaldboulton opened this issue Jan 27, 2020 · 9 comments
Closed

Cannot resolve core-js #187

donaldboulton opened this issue Jan 27, 2020 · 9 comments
Assignees
Milestone

Comments

@donaldboulton
Copy link

Gatsby Error using npm

Can't resolve 'core-js/modules/es.array.concat' in 'C:\Users\Donald Boulton\Documents\GitHub\publiuslogic\publiuslogic\node_modules\react-avatar\es\sources'

Can't resolve 'core-js/modules/ANY AND ALL MODULES IN THIS DIRECTORY' in 'C:\Users\Donald Boulton\Documents\GitHub\publiuslogic\publiuslogic\node_modules\react-avatar\es\sources'

File: node_modules\react-avatar\es\sources\Github.js

package-json-lock ile
is calling two versions of core.js ???
"react-avatar": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/react-avatar/-/react-avatar-3.9.0.tgz", "integrity": "sha512-i9UR3z/Y4JhAb6WH0yaAr6noLwLVgUyp7kOMu48Plc9ch6OQ3k4aDqp+m0TrCbHAn8YfRv2BevK9gA0nIqwVbA==", "requires": { "core-js": "^3.6.1", "is-retina": "^1.0.3", "md5": "^2.0.0" }, "dependencies": { "core-js": { "version": "3.6.4", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.4.tgz", "integrity": "sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw==" } }

@JorgenEvens
Copy link
Member

Hi @donaldboulton ,

I've been able to reproduce the issue and will be looking into what the fix should be here.

It looks like some interaction between react-avatar and gatsby as the issue does not occur in a plain react test.

@JorgenEvens JorgenEvens self-assigned this Feb 12, 2020
@JorgenEvens JorgenEvens added this to the 3.9.1 milestone Feb 12, 2020
@wdavidw
Copy link

wdavidw commented Feb 13, 2020

Hi, @JorgenEvens have you made any progress ?

@JorgenEvens
Copy link
Member

Hi @donaldboulton, @wdavidw,

This seems to be a known issue with gatsby and libraries using core-js@3, more here.

Adding the following snippet in your gatsby-node.js will make react-avatar work (see comment).

exports.onCreateWebpackConfig = ({ actions, getConfig }) => {
  const config = getConfig()
  delete config.resolve.alias["core-js"]
  actions.replaceWebpackConfig(config)
}

Here is a working reproduction.

@donaldboulton
Copy link
Author

donaldboulton commented Feb 19, 2020

Fix Works perfect or some other things I had core=js issues with, but not react avatar.

Thank You
Donald Boulton

@wdavidw
Copy link

wdavidw commented Feb 19, 2020

Same with me, thanks

@JorgenEvens
Copy link
Member

JorgenEvens commented Feb 19, 2020

So the fix suggested in the thread I linked does not work for react-avatar? Does the reproduction work for you?

The suggested fix worked for me on a fresh gatsby project, but if you are still experiencing issues I'll re-open the issue.

To further investigate the issue, could you provide me with a project that is having the described issue?

@hijarian
Copy link

@JorgenEvens The solution provided in #187 (comment) did work for me only after I added core-js@3 as an explicit dependency to the whole project. It was an implicit dependency on gatsbyjs and on react-avatar initially. Until I added core-js as a dependency on the whole project, I have been getting the same error as described in the OP.

@JorgenEvens
Copy link
Member

Hi @hijarian,

Thanks for the update, your comment will surely help the community out until the issue is fixed in gatsby. [1]

@MoSattler
Copy link

I have the same problem with remix in production. anyone an idea?

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

No branches or pull requests

5 participants