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

Cannot find module 'intl' #9306

Closed
bote795 opened this issue Jun 28, 2019 · 7 comments
Closed

Cannot find module 'intl' #9306

bote795 opened this issue Jun 28, 2019 · 7 comments

Comments

@bote795
Copy link

bote795 commented Jun 28, 2019

Provide the steps to reproduce

  1. Run LH on cypress
import lighthouse from 'lighthouse';
describe('My First Test', function() {
  it('Does not do much!', function() {
    expect(true).to.equal(true);
  });
});

repo with example:
https://github.com/bote795/cypress-test-tiny

npm run cypress:run

What is the current behavior?

Doesn't really get past the first line
Error: Cannot find module 'intl' from '/Users/nicolasbotello/Documents/workspace/code/rmc/node_modules/lighthouse/lighthouse-core/lib/i18n'

What is the expected behavior?

file to run successfully don't get any errors.

Environment Information

  • Affected Channels:
  • Lighthouse version: 5.1.0
  • Node.js version:v10.15.0
  • Operating System: Macos

Related issues
Not sure if this is a lighthouse or cypress issue?

@connorjclark
Copy link
Collaborator

intl is a dev dep for LH, which is why you don't get it installed when adding lighthouse to your package.json deps.

You can add intl and it will fix it (but then the next missing module comes up, bufferutil ...)

As to what LH should change, maybe intl should be part of our dependencies? @brendankenny / @exterkamp might know more, I'm not very familiar with how i18n.js works.

@connorjclark
Copy link
Collaborator

Also, thanks for providing a repro! Very useful.

@bote795
Copy link
Author

bote795 commented Jun 28, 2019

@connorjclark so if i add intl then bufferutil, it will just continue to ask to install everything right?

@connorjclark
Copy link
Collaborator

connorjclark commented Jun 28, 2019

Maybe? We don't even use bufferutil - it is included via ws devDeps much like how we include intl (in a try/catch):

image

I'm guessing cypress doesn't like that paradigm very much. If there's one issue to report to cypress, that may be it.

@patrickhulce
Copy link
Collaborator

patrickhulce commented Jun 28, 2019

This sounds like a cypress issue. All of these require statements are guarded by try/catch and in normal node execution should pass right on through the optional requires just fine.

That being said, we should probably be moving our intl dependency to dependencies though as @connorjclark points out. Right now most node consumers probably don't know they would need to install this package manually for complete i18n support.

@bote795
Copy link
Author

bote795 commented Jun 28, 2019

so I added bufferutil, intl, utf-8-validate
Then I got the following error

Uncaught TypeError: require.resolve is not a function

This error originated from your test code, not from Cypress.

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.

will follow up with the cypress team.
Thanks for y'alls help!

@ianaya89
Copy link

ianaya89 commented Feb 4, 2020

@bote795 I am working in the same approach (cypress + lighthouse) and facing the same issue. Could you find a workaround?

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

4 participants