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

Can't resolve 'core-js/modules/es.*' #2295

Closed
vladluca opened this issue Mar 27, 2020 · 25 comments
Closed

Can't resolve 'core-js/modules/es.*' #2295

vladluca opened this issue Mar 27, 2020 · 25 comments

Comments

@vladluca
Copy link

vladluca commented Mar 27, 2020

Hi guys, I'm facing the following error since updating from amcharts4 4.9.9 to 4.9.12.
The problem seems to be since amcharts4 uses canvg 3.0.*

Screenshot 2020-03-27 at 12 19 14

Any ideea on how can it be fixed?
Thank you!

@martynasma
Copy link
Collaborator

We're looking into this.

Meanwhile it would help if you could provide all the modules and versions you are using in your app.

@vladluca
Copy link
Author

vladluca commented Mar 27, 2020

I have core-js 2.0.* as a dependecy for @babel. Amcharts4 is using canvg 3.0.* since version 4.9.10 which has core-js 3.0.* as a dependency. My guess is that canvg is trying to load the core-js from the wrong place, because the files exist in the canvg node_modules.

Screenshot 2020-03-27 at 11 58 49

@vladluca
Copy link
Author

vladluca commented Mar 27, 2020

My dependecies:

{
  "devDependencies": {
    "@babel/cli": "^7.8.4",
    "@babel/core": "^7.8.4",
    "@babel/plugin-proposal-class-properties": "^7.8.3",
    "@babel/plugin-syntax-export-default-from": "^7.8.3",
    "@babel/preset-env": "^7.8.4",
    "@babel/preset-react": "^7.8.3",
    "@babel/preset-typescript": "^7.8.3",
    "@hot-loader/react-dom": "16.8.6",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.2.0",
    "@testing-library/react-hooks": "^2.0.1",
    "@types/jest": "^25.1.1",
    "@typescript-eslint/eslint-plugin": "^2.19.0",
    "@typescript-eslint/parser": "^2.19.0",
    "audit-ci": "^1.7.0",
    "babel-eslint": "^9.0.0",
    "babel-jest": "^24.8.0",
    "babel-loader": "^8.0.0",
    "clean-webpack-plugin": "^0.1.19",
    "css-loader": "^1.0.0",
    "css-modules-typescript-loader": "^4.0.0",
    "cssnano": "^4.1.4",
    "eslint": "^6.8.0",
    "eslint-config-prettier": "^6.10.0",
    "eslint-plugin-prettier": "^3.1.2",
    "eslint-plugin-react": "^7.18.3",
    "fork-ts-checker-webpack-plugin": "^4.0.3",
    "husky": "^1.3.1",
    "identity-obj-proxy": "^3.0.0",
    "import-cwd": "^2.1.0",
    "jest": "^24.8.0",
    "lint-staged": "^8.1.4",
    "mini-css-extract-plugin": "^0.5.0",
    "node-sass": "^4.13.1",
    "optimize-css-assets-webpack-plugin": "^5.0.1",
    "postcss-import": "^12.0.0",
    "postcss-loader": "^3.0.0",
    "postcss-nested": "^4.1.0",
    "postcss-preset-env": "^6.0.0",
    "postcss-scss": "^2.0.0",
    "prettier": "^1.19.1",
    "sass-loader": "^7.1.0",
    "style-loader": "^0.23.0",
    "type-coverage": "^2.4.0",
    "uglifyjs-webpack-plugin": "^2.1.1",
    "webpack": "4.29.6",
    "webpack-assets-manifest": "^3.1.1",
    "webpack-bundle-analyzer": "^3.0.3",
    "webpack-cli": "3.3.0",
    "webpack-dev-server": "^3.2.1",
    "webpack-merge": "^4.1.4",
    "webpack-node-externals": "^1.7.2",
    "webpack-notifier": "1.6.0"
  },
  "dependencies": {
    "@amcharts/amcharts4": "^4.9.12",
    "@types/react": "^16.9.20",
    "classnames": "2.2.6",
    "core-js": "^3.6.4",
    "flatpickr": "^4.6.1",
    "i18next": "^17.0.11",
    "i18next-fetch-backend": "0.0.1",
    "imask": "4.1.5",
    "moment": "2.24.0",
    "react": "^16.12.0",
    "react-bootstrap": "0.32.4",
    "react-dom": "16.8.6",
    "react-hot-loader": "4.11.1",
    "react-i18next": "^10.12.0",
    "reselect": "4.0.0",
    "shortid": "2.2.14",
    "typescript": "^3.7.5",
    "whatwg-fetch": "2.0.3"
  }
}```

@Numose
Copy link

Numose commented Mar 29, 2020

Can confirm this, let me know if/what details you want for debugging. I went 4.6.X -> 4.9.12 (broken) then -> 4.9.9 per the first comment and it works perfectly. Thank you and keep up the great work.

@Pauan
Copy link
Collaborator

Pauan commented Mar 29, 2020

@vladluca Your package.json shows that you're using core-js 3. Could you show your yarn.lock or package-lock.json files?

@vladluca
Copy link
Author

vladluca commented Mar 30, 2020

So I have core-js 2 as a dependency for @babel and core-js 3 as a dependency for canvg. From what I can see, core-js 2 is installed top-level in node_modules while core-js 3 is installed as a nested dependency inside canvg node_modules. The problem is that canvg is trying to read from the top-level core-js 2 instead of reading from it's own node_modules. Thanks!

"@amcharts/amcharts4@4.9.12":
  version "4.9.12"
  resolved "https://registry.yarnpkg.com/@amcharts/amcharts4/-/amcharts4-4.9.12.tgz#3d3453ac42f9a2b8412abe9748212bc7d1d986d8"
  integrity sha512-Xme+H3wtGDtnssvLESm5yHV2fkb/RRbfFNag0MAO8/iKHAj6j/UtC0uyaCNlWIEEjIlQs+X0k2BCIFcE5MiDog==
  dependencies:
    "@types/regression" "^2.0.0"
    canvg "^3.0.0"
    css-element-queries "1.2.1"
    d3-force "^2.0.1"
    d3-geo "^1.11.3"
    d3-geo-projection "^2.6.0"
    pdfmake "^0.1.36"
    polylabel "^1.0.2"
    regression "^2.0.1"
    tslib "^1.9.3"
    venn.js "^0.2.20"
    xlsx "^0.15.4"

"@babel/polyfill@^7.4.4":
  version "7.8.3"
  resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.8.3.tgz#2333fc2144a542a7c07da39502ceeeb3abe4debd"
  integrity sha512-0QEgn2zkCzqGIkSWWAEmvxD7e00Nm9asTtQvi7HdlYvMhjy/J38V/1Y9ode0zEJeIuxAI0uftiAzqc7nVeWUGg==
  dependencies:
    core-js "^2.6.5"
    regenerator-runtime "^0.13.2"

"@babel/runtime-corejs2@^7.0.0":
  version "7.8.4"
  resolved "https://registry.yarnpkg.com/@babel/runtime-corejs2/-/runtime-corejs2-7.8.4.tgz#e4ed23a8be40fa26b97fb649deaba8144c987593"
  integrity sha512-7jU2FgNqNHX6yTuU/Dr/vH5/O8eVL9U85MG5aDw1LzGfCvvhXC1shdXfVzCQDsoY967yrAKeLujRv7l8BU+dZA==
  dependencies:
    core-js "^2.6.5"
    regenerator-runtime "^0.13.2"

canvg@^3.0.0:
  version "3.0.6"
  resolved "https://registry.yarnpkg.com/canvg/-/canvg-3.0.6.tgz#4f82a34acc433daa06c494fc255420cbbb05f903"
  integrity sha512-eFUy8R/4DgocR93LF8lr+YUxW4PYblUe/Q1gz2osk/cI5n8AsYdassvln0D9QPhLXQ6Lx7l8hwtT8FLvOn2Ihg==
  dependencies:
    "@babel/runtime" "^7.6.3"
    "@types/raf" "^3.4.0"
    core-js "3"
    raf "^3.4.1"
    rgbcolor "^1.0.1"
    stackblur-canvas "^2.0.0"

core-js-compat@^3.6.2:
  version "3.6.4"
  resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.4.tgz#938476569ebb6cda80d339bcf199fae4f16fff17"
  integrity sha512-zAa3IZPvsJ0slViBQ2z+vgyyTuhd3MFn1rBQjZSKVEgB0UMYhUkCj9jJUVPgGTGqWvsBVmfnruXgTcNyTlEiSA==
  dependencies:
    browserslist "^4.8.3"
    semver "7.0.0"

core-js@3:
  version "3.6.4"
  resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.4.tgz#440a83536b458114b9cb2ac1580ba377dc470647"
  integrity sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw==

core-js@^2.4.0, core-js@^2.6.5:
  version "2.6.11"
  resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c"
  integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==

@Pauan
Copy link
Collaborator

Pauan commented Mar 31, 2020

@vladluca Thanks. I'm still unable to reproduce this, even when using the Babel dependencies.

If you run yarn upgrade does that fix it?

If not, try deleting your node_modules folder and yarn.lock, then run yarn install.

@vladluca
Copy link
Author

vladluca commented Apr 1, 2020

@vladluca Thanks. I'm still unable to reproduce this, even when using the Babel dependencies.

If you run yarn upgrade does that fix it?

If not, try deleting your node_modules folder and yarn.lock, then run yarn install.

Already tried but with no luck 😐

@Pauan
Copy link
Collaborator

Pauan commented Apr 1, 2020

@vladluca Could you share more of your configuration? Such as your webpack.config.js, tsconfig.json, etc.

Or even better, if you could create a repo which reproduces the problem.

@vladluca
Copy link
Author

vladluca commented Apr 2, 2020

It looks more like a problem with my configuration or even npm, I'm not sure at the moment, but I think it does not make sense to waste more of your time since it's not an issue with amcharts.
Thank you for support and If I will find the issue I will add it here also.

@aikodeio
Copy link

aikodeio commented Apr 9, 2020

I have the same problem! Any solution? thanks!

@Pauan
Copy link
Collaborator

Pauan commented Apr 10, 2020

@aikodeio Please share your code (ideally in a GitHub repo) so we can figure out what the problem is.

@aikodeio
Copy link

@Pauan @vladluca I had to install version 4.8.1 to avoid the problem...

@Pauan
Copy link
Collaborator

Pauan commented Apr 11, 2020

@aikodeio We cannot help you unless you show your code, because we cannot reproduce this problem with any of our examples.

@fxue89
Copy link

fxue89 commented Apr 12, 2020

@Pauan I got similar issue when using gatsby. Maybe try a gatsby starter code base. It's a problem with opinionated core-js version, and I spent hours trying to resolve it but no luck. But for my problem, I believe it's more of a gatsby team's problem. But would be good if it could be solved.

@aikodeio
Copy link

@fxue89 I am also using GatsbyJs. Use the latest version of Gatsby with Amcharts version 4.8 and it works fine for now!

@mbangar
Copy link

mbangar commented Apr 15, 2020

I am also facing similar issue with my Quasar project (its UI framework build on vueJs). First I setup project using quasar CLI and it was working fine. but once i install '@amcharts/amcharts4' and '@amcharts/amcharts4-geodata' it start breaking with errors like, core-js related dependencies were not found,

image

my dependencies and dev-dependencies are,

"dependencies": {
"@amcharts/amcharts4": "^4.9.12",
"@amcharts/amcharts4-geodata": "^4.1.12",
"@quasar/extras": "^1.0.0",
"axios": "^0.18.1",
"quasar": "^1.0.0"
},
"devDependencies": {
"@quasar/app": "^1.0.0",
"babel-eslint": "^10.0.1",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.0",
"eslint-loader": "^3.0.3",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.1.2"
},

**Everything works fine if i use older version of amcharts (i.e. "@amcharts/amcharts4": "4.9.5"). but I need latest version of amcharts for my project.

@mbangar
Copy link

mbangar commented Apr 16, 2020

I have added 2.6.5 core-js in my dependency and everything seems to be working smoothly.
(i.e. "core-js": "2.6.5")

@Pauan
Copy link
Collaborator

Pauan commented Apr 18, 2020

@fxue89 Thanks for the tip, I was able to reproduce it in Gatsby. We're working on fixing it.

@Pauan
Copy link
Collaborator

Pauan commented Apr 18, 2020

It appears to be a bug in Gatsby, so I filed a new issue, it will be up to them to fix it.

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@melvinotieno
Copy link

This issue has not been resolved yet. What is the workaround for now?

@Pauan
Copy link
Collaborator

Pauan commented Jul 13, 2020

@melvinotieno Wait for the next version of Gatsby, they have upgraded to core-js 3.

@melvinotieno
Copy link

melvinotieno commented Jul 13, 2020 via email

@vladluca
Copy link
Author

vladluca commented Jul 7, 2021

I managed to find the problem and it was in my webpack config. The fix was to change

resolve: {
    modules: [path.join(__dirname, 'node_modules')],
    ...
},

to:

resolve: {
    modules: ['node_modules'],
    ...
},

This was the reason why amcharts was getting the wrong core-js dependency from the top-level instead of looking for its own dependency.

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

8 participants