gatsby: [V2] Error: WebpackError: Cannot find module 'core-js/modules/es6.object.assign'

Description

Following Error encountered upon running gatsby develop in the terminal

error There was an error compiling the html.js component for the development server.

See our docs page on debugging HTML builds for help https://gatsby.dev/debug-html

WebpackError: Cannot find module ‘core-js/modules/es6.object.assign’

  • gatsby-browser-entry.js:1 Function.Module._load lib/.cache/gatsby-browser-entry.js:1:1

  • universalModuleDefinition:3 webpackUniversalModuleDefinition lib/webpack/universalModuleDefinition:3:1

  • universalModuleDefinition:10 Object.<anonymous> lib/webpack/universalModuleDefinition:10:2

  • extends.js:2 Object.Module._extensions…js [lib]/[@babel]/runtime/helpers/esm/extends.js:2:1

  • gatsby-browser-entry.js:1 Function.Module._load lib/.cache/gatsby-browser-entry.js:1:1

  • bootstrap:21 Promise lib/webpack/bootstrap:21:1

  • develop-static-entry.js:34 Promise._resolveFromExecutor lib/.cache/develop-static-entry.js:34:7


Steps to reproduce

Upgraded firebase to: v5.9.3 formik to: v1.5.2

ran gatsby develop

encountered the error


Exact combination of packages and their versions.

“dependencies”: { “firebase”: “^5.9.3”, “formik”: “^1.5.2”, “gatsby”: “^2.3.15”, “gatsby-image”: “^2.0.37”, “gatsby-plugin-manifest”: “^2.0.27”, “gatsby-plugin-offline”: “^2.0.25”, “gatsby-plugin-react-helmet”: “^3.0.12”, “gatsby-plugin-sharp”: “^2.0.32”, “gatsby-source-filesystem”: “^2.0.29”, “gatsby-transformer-sharp”: “^2.1.17”, “prop-types”: “^15.7.2”, “react”: “^16.8.6”, “react-dom”: “^16.8.6”, “react-helmet”: “^5.2.0”, “react-redux”: “^6.0.1”, “redux”: “^4.0.1”, “redux-starter-kit”: “^0.4.3”, “redux-thunk”: “^2.3.0” }, “devDependencies”: { “eslint”: “^5.16.0”, “eslint-config-airbnb”: “^17.1.0”, “eslint-config-prettier”: “^4.1.0”, “eslint-plugin-prettier”: “^3.0.1”, “eslint-plugin-react”: “^7.12.4”, “graphql”: “^14.2.1”, “prettier”: “^1.16.4” },


Expected result

What should happen? The build should’ve completed successfully and the site should’ve been served on the localhost

Actual result

What happened. The build failed with the above mentioned message.

Environment

Run gatsby info --clipboard in your project directory and paste the output here.

System: OS: Windows 10 CPU: (8) x64 Intel® Core™ i7-7700HQ CPU @ 2.80GHz Binaries: Node: 11.13.0 - D:\devlibs\Node\node.EXE Yarn: 1.15.2 - D:\Dev\Libs\Yarn\bin\yarn.CMD npm: 6.9.0 - D:\devlibs\Node\npm.CMD Browsers: Edge: 44.17763.1.0 npmPackages: gatsby: ^2.3.15 => 2.3.15 gatsby-image: ^2.0.37 => 2.0.37 gatsby-plugin-manifest: ^2.0.27 => 2.0.27 gatsby-plugin-offline: ^2.0.25 => 2.0.25 gatsby-plugin-react-helmet: ^3.0.12 => 3.0.12 gatsby-plugin-sharp: ^2.0.32 => 2.0.32 gatsby-source-filesystem: ^2.0.29 => 2.0.29 gatsby-transformer-sharp: ^2.1.17 => 2.1.17

error UNHANDLED REJECTION Error: The system cannot find the path specified.

  • envinfo.js:1 Function.e.exports.sync [npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:4908

  • envinfo.js:1 Object.copySync [npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:66886

  • envinfo.js:1 Object.t.writeSync.e [as writeSync] [npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:48715

  • envinfo.js:1 [npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:46872

  • envinfo.js:1 Promise.all.then.e [npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:46887

  • task_queues.js:86 processTicksAndRejections internal/process/task_queues.js:86:5

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 28 (8 by maintainers)

Most upvoted comments

Already tried adding ad removing core-js@2 and core-js@latest

deleted node_modules, .cache, package-lock.json and yarn.lock and re-installed packages. The error remains the same.

I was still getting an error but this fixed it:

import { firebase } from '@firebase/app'
import 'firebase/auth'

No need to install core-js module.

@adberard if you still want to use the latest firebase you can do this:

// import * as firebase from `firebase/app`; replace this line with the line below.
import * as firebase from '@firebase/app'; 

as mentioned here

and i think it is ok to close this issue because like @simoneb said this issue is possibly duplicate of #7862 and #12744

@VallyPepyako firebase < 5.9.0 still works with core-js@2.6.5 my current solution regarding this problem is just downgrade firebase to version 5.9.0

@adberard if you still want to use the latest firebase you can do this:

// import * as firebase from `firebase/app`; replace this line with the line below.
import * as firebase from '@firebase/app'; 

as mentioned here

and i think it is ok to close this issue because like @simoneb said this issue is possibly duplicate of #7862 and #12744

While i agree that the issues seems to be duplicate of the issues you’ve listed, there are still a few things made me file a new issue.

  1. The solutions to the problems mentioned in those issues didn’t work for the my code.
  2. Those issues have been closed, and this particular combination of libraries may have led to another underlying issue to resurface with the newer releases.

I would be more than happy to have this issue closed once I find a solution that works.

also having the same issue. i wonder if this issue is caused because of firebase?

I guess its something like deadlock, gatsby didn’t work with core-js@3 firebase didn’t work with @2 )

This bug appeared multiple times in the past, see #7862 and #12744. The solution for me was this one. But I shall say, these random issues appear quite frequently and it’s scary to think that at any time the CI/CD pipeline can break for obscure reasons and no changes to the code except for a slightly loose versioning scheme.

I tend to prefer to avoid strict package versioning in the applications I write, to allow getting fixes and improvements from package authors, but gatsby is not very friendly in that sense.

I just had the same error, I needed to remove core-js that I just installed because firebase was missing it and it fixed it. But now I cannot use firebase

Hi!

Do anyone has a simple repository with the right dependencies for Firebase and Gatsby and implementing them?

I am sorry reopening this conversation but I could not solve this issue (I read all of your solutions) and I have tried everything.

I found this page via Google when searching on this same error. In my case, I first encountered the error when trying to spin up a sample project from the Material UI/gatsby repo, and was not able to run gatsby develop due to this same error:

WebpackError: Cannot find module ‘core-js/modules/es6.object.assign’

I found a similar starter kit on gatsbyjs.org that uses Material UI and clicked the “Try this starter” link to automatically spin up a Netlify build. The Netlify deploy fails with the exact same error (on a starter kit unrelated to the repo I am trying to run local.) See screenshot from Netlify deploy log:

netlify

On local development, it seems I am able to fix this by forcing an install of core-js version 2:

npm i core-js@^2.0.0

This allows me to run gatsby develop with no errors, but not sure what (if any) repercussions there may be from forcing that old version. (Presumably Gatsby is otherwise installing v3?)

Gatsby version: 2.5.12

I got the same issue without firebase and solved with core-js@2.6.5 the 3.0 didn’t work.

Sorry about this!

Could you provide a reproduction? It will drastically speed up the time we can check things out and find a fix!

Reproduction link: https://github.com/myTDC/tdc-works/tree/corejs-bug

Okay I managed to make it work !

 "dependencies": {
    "firebase": "5.9.0",
    "gatsby": "^2.3.15",
    "react": "^16.8.6",
    "react-dom": "^16.8.6"
  },

(it doesnt work either when the ^ is in front tho)

also having the same issue. i wonder if this issue is caused because of firebase?