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

Module not found: Error: Can't resolve 'babel-runtime/regenerator' #310

Closed
kozubikmichal opened this issue Nov 29, 2018 · 12 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@kozubikmichal
Copy link

Hi,

I'm facing build error propably due to babel versions conflict.

This is output from Webpack:

ERROR in ./node_modules/pdfjs-dist/lib/web/ui_utils.js
Module not found: Error: Can't resolve 'babel-runtime/regenerator' in 'C:\Users\******\repos\la_client\node_modules\pdfjs-dist\lib\web'
 @ ./node_modules/pdfjs-dist/lib/web/ui_utils.js 29:19-55
 @ ./node_modules/pdfjs-dist/lib/web/pdf_link_service.js
 @ ./node_modules/react-pdf/dist/LinkService.js
 @ ./node_modules/react-pdf/dist/Document.js
 @ ./node_modules/react-pdf/dist/entry.js

I found this issue mozilla/pdf.js#10280 so if I get it right this will be fixed with new version of pdfjs-dist.
But according to info/issues on react-pdf project it seems that for some people it is already working now with pdfjs-dist 2.0.943. Is there any additional step to make this working?

Environment

  • React-PDF version: 4.0.0
  • React version: 16.6.3
  • Webpack version: 4.26.1

Regards
Michal

@wojtekmaj
Copy link
Owner

wojtekmaj commented Dec 2, 2018

I guess you could npm i babel-runtime or yarn add babel-runtime in the meantime, which would add the missing module and stop the error from happening. I updated pdfjs-dist to Babel 7 in mozilla/pdf.js#10293. Babel 6 or 7 though, doesn't really matter, I think this means babel-runtime is required by pdfjs-dist and as such should be listed in dependencies.

For the time being, babel-runtime may be listed as React-PDF dependency to prevent that error from happening.

@wojtekmaj
Copy link
Owner

I notified Mozilla about missing dependency in mozilla/pdf.js#10280.

@wojtekmaj wojtekmaj self-assigned this Dec 2, 2018
@wojtekmaj wojtekmaj changed the title Babel conflict Module not found: Error: Can't resolve 'babel-runtime/regenerator' Dec 2, 2018
@wojtekmaj wojtekmaj added the bug Something isn't working label Dec 2, 2018
@rogordan
Copy link

I have a similar issue. If I add babel-runtime manually it causes an issue with duplicate packages because there is babel-runtime/regenerator and @babel/runtime/regenerator. My build only succeeded when I went into pdfjs and manually pasted the path to my @babel/runtime/regenerator. I think the less hacky hack would be to use webpack aliasing to resolve the right runtime-regenerator, but I can't figure that out.

I guess I'm wondering if there's some other way to address this.

@wojtekmaj
Copy link
Owner

wojtekmaj commented Jan 5, 2019

Hi all,
this should be fixed with the next minor release (after 4.0.1)
We're waiting for Mozilla to release pdf.js 2.1.x (mozilla/pdf.js#10416) to have this fixed.
Thanks for your patience.

@wojtekmaj wojtekmaj reopened this Jan 5, 2019
wojtekmaj added a commit that referenced this issue Jan 26, 2019
Related to #310
To be rolled back after PDF.js 2.1.x release
@ebongso
Copy link

ebongso commented Feb 13, 2019

Thanks @wojtekmaj. We encountered the same issue today and did npm i --save-dev babel-runtime. The problem was resolved.

@allanchua101
Copy link

We also experienced same issue today. Using npm i --save-dev babel-runtime fixes the problem, but is it the best way to work around it?

@wojtekmaj
Copy link
Owner

@allanchua101 that is the best way to work around it ;) Mozilla is about to release a new version of PDF.js though, so this workaround should no longer be needed soon.

@wojtekmaj
Copy link
Owner

All, React-PDF 4.0.3 is out and should have this issue resolved.

@benabbon

This comment has been minimized.

@wojtekmaj

This comment has been minimized.

@benabbon

This comment has been minimized.

@sensoeurn
Copy link

****** My error :

This dependency was not found:

  • babel-runtime/regenerator in ./node_modules/pdfjs-dist/lib/web/ui_utils.js

To install it, you can run: npm install --save babel-runtime/regenerator

****** after I run the commad => npm i --save-dev babel-runtime

It works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants