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

Created on 31 Jul 2019  路  13Comments  路  Source: Redocly/redoc

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?

Most helpful comment

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

All 13 comments

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.

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

@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?

@RomanHotsiy will give that a shot, thanks

Maybe corejs@3 should be added here?

@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 ;)

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

Thanks!

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?

@MarcusCemes Gatsby currently will hardcode core-js@2 causing this error https://github.com/gatsbyjs/gatsby/issues/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.

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

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

This answer solves the issue for my documentation with Gatsby.

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

@adamsoffer any details?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JFCote picture JFCote  路  3Comments

gavinkalika picture gavinkalika  路  3Comments

zmes50416 picture zmes50416  路  3Comments

ahshum picture ahshum  路  3Comments

vietnguyen010 picture vietnguyen010  路  3Comments