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' #4607

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

Cannot find module 'intl' #4607

bote795 opened this issue Jun 28, 2019 · 2 comments

Comments

@bote795
Copy link

bote795 commented Jun 28, 2019

Current behavior:

im getting following error: Cannot find module 'intl' from '/Users/nicolasbotello/Documents/workspace/code/rmc/node_modules/lighthouse/lighthouse-core/lib/i18n

Error: Cannot find module 'intl' from '/Users/nicolasbotello/Documents/workspace/code/rmc/node_modules/lighthouse/lighthouse-core/lib/i18n'
    at /Users/nicolasbotello/Library/Caches/Cypress/3.3.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/browser-resolve/node_modules/resolve/lib/async.js:46:17
    at process (/Users/nicolasbotello/Library/Caches/Cypress/3.3.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/browser-resolve/node_modules/resolve/lib/async.js:173:43)
    at ondir (/Users/nicolasbotello/Library/Caches/Cypress/3.3.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/browser-resolve/node_modules/resolve/lib/async.js:188:17)
    at load (/Users/nicolasbotello/Library/Caches/Cypress/3.3.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
    at onex (/Users/nicolasbotello/Library/Caches/Cypress/3.3.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
    at /Users/nicolasbotello/Library/Caches/Cypress/3.3.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
    at /Users/nicolasbotello/Library/Caches/Cypress/3.3.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/graceful-fs/polyfills.js:282:31
    at FSReqWrap.oncomplete (fs.js:152:21)

Desired behavior:

No errors

Steps to reproduce: (app code and test code)

install cypress
install lighthouse

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

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

Versions

Lighthouse version: 5.1.0
Node.js version:v10.15.0
cypress version: 3.3.1

@bote795
Copy link
Author

bote795 commented Jun 28, 2019

Talked with lighthouse team and they recommended adding intl since they were dev requirements and I followed it n got here:

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.

also not sure if this helps: GoogleChrome/lighthouse#9306

@jennifer-shehane
Copy link
Member

Spec files within Cypress are run within the context of the browser. As stated by the lighthouse team, this dep is meant to be run in the Node context.

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.

You can follow the instructions given here on how to utilize Node code in your Cypress spec files: https://on.cypress.io/using-cypress-faq#How-do-I-require-or-import-node-modules-in-Cypress

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

2 participants