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

[#814] Unfixed problem, dependency 'core-js/es6/promise' is missing #997

Closed
eau-de-la-seine opened this issue Jul 31, 2019 · 13 comments
Closed

Comments

@eau-de-la-seine
Copy link

Hi, I still have the problem declared in the issue number 814

Problem:

Failed to compile
./node_modules/redoc/bundles/redoc.lib.js
Module not found: Can't resolve 'core-js/es6/promise' in '/home/gekinci/projects/pmu/pmu-redoc/node_modules/redoc/bundles'

My dependencies (package.json):

  "dependencies": {
    "core-js": "^3.1.4",
    "es6-promise": "^4.2.8",
    "mobx": "^4.13.0",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-scripts": "3.0.1",
    "redoc": "^2.0.0-rc.10",
    "styled-components": "^4.3.2"
  }

Installed with:

npm install mobx@^4.2.0 styled-components core-js es6-promise
npm install redoc --save

So I've installed the following dependency: core-js but nothing has changed. So I've looked into your Redoc code in /node_modules/redoc/bundles/redoc.lib.js:

module.exports = require("core-js/es6/promise");

But what you're looking for with core-js is installed here: core-js/es/promise, not here: core-js/es6/promise

Workaround:
So my workaround was to copy/paste the existing /node_modules/core-js/es folder and rename it to /node_modules/core-js/es6. Is this a bug or did I miss something during the installation of Redoc with npm?

@eau-de-la-seine
Copy link
Author

I don't understand why you have closed this issue without indicating what the problem was, or what I've had to do to resolve it.
The best workaround I've found was to install this old version of core-js: 2.6.8 because it contains es6 (also es5 and es7) folders.

@qw-in
Copy link
Contributor

qw-in commented Aug 9, 2019

I updated 2.0.0-rc.12 => 2.0.0-rc.14 and ran into this issue. Reverting for now but +1

@RomanHotsiy
Copy link
Member

@eau-de-la-seine Just upgrading redoc to rc.14 and core-js to version 3 should work.

@qw-in could you provide more details? Have you upgraded core-js to version 3?

@qw-in
Copy link
Contributor

qw-in commented Aug 13, 2019

@RomanHotsiy will give that a shot, thanks

Maybe corejs@3 should be added here?

@eau-de-la-seine
Copy link
Author

@RomanHotsiy will give that a shot, thanks

Maybe corejs@3 should be added here?

Yes, and there too: https://www.npmjs.com/package/redoc#usage-as-a-react-component ;)

@transitive-bullshit
Copy link

@RomanHotsiy please reopen this issue until #1018 or another fix is resolved.

Thanks!

@MarcusCemes
Copy link

I opened an issue here when encountering this problem with Gatsby (does not occur with skeleton Webpack config).

I didn't find this originally as it was closed, this issue should be open.

@RomanHotsiy Can confirm a similar error occurs with core-js 3.2.1 and redoc 2.0.0-rc.14.

I get Module not found: Error: Can't resolve 'core-js/es/promise' (and not es6), which is a valid export, more context is available in the above Gatsby issue.

While on the subject, would it not be easier creating a redoc-react package which includes all the required peer dependencies instead of clogging up package.json with extra requirements?

@thovden
Copy link

thovden commented Sep 13, 2019

@MarcusCemes Gatsby currently will hardcode core-js@2 causing this error gatsbyjs/gatsby#17136 . I agree though that redoc should not require a specific core-js version externally.

This means that currently redoc@>2.0.0-rc.12 does not work with Gatsby.

@donysukardi
Copy link

I used patch-package as a workaround to get Gatsby working with redoc by changing the import to core-js/es6/promise

@seanlaff
Copy link

#1018 Was just a documentation change, is the a reason this dep wasn't added as a real peerDependency?

@israteneda
Copy link

This answer solves the issue for my documentation with Gatsby.

@adamsoffer
Copy link

adamsoffer commented Aug 18, 2020

I'm still encountering this error when using with next.js. Can we reopen?

@RomanHotsiy
Copy link
Member

@adamsoffer any details?

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

10 participants