question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find module './types/standard' from 'index.js'

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.5.0
  • Platform / OS version: Windows 7
  • URLs (if applicable): repo
  • Node.js version: 10.4.0

What steps will reproduce the problem?

Please include code that reproduces the issue.

  1. upgrade puppeteer from 1.1.1 to 1.5.0 version
  2. run test: ````npm test App1```

What is the expected result? to run puppeteer

What happens instead? error:

    Cannot find module './types/standard' from 'index.js'

      at Resolver.resolveModule (../node_modules/jest-resolve/build/index.js:210:17)
      at Object.<anonymous> (../node_modules/puppeteer/node_modules/mime/index.js:4:27)

if I return to 1.1.1 version - puppeteer runs and pass the test

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:12
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

110reactions
AdirAmsalemcommented, Jul 8, 2018

Cause: The error happens because puppeteer v1.5 started to use mime@2.x: https://github.com/GoogleChrome/puppeteer/commit/37cc9f567d9c2d8da1eeb630d13202e95a48cbed#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R32).

in mime@2.x they added a require to a JSON file: https://github.com/broofa/node-mime/blob/master/index.js#L4

Most “copy-paste” Jest configurations doesn’t support loading JSONs as-is, so that’s probably the cause.

To solve the problem: Simply add “json” to the moduleFileExtensions entry in the jest property in your package.json file.

// package.json

"jest": {
  "moduleFileExtensions": [
    "json"
  ]
}

- You probably already have other extensions there, so make sure not to remove them but to add “json” in addition.

2reactions
jonjiang1commented, Jun 19, 2018

Also had the same error and downgrading worked. Is there no other fix though?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues - GitHub
Cannot find module './types/standard' from 'index.js' #2754 ... The error itself doesn't relate to puppeteer: instead it has something to do ...
Read more >
0 - Stack Overflow
Error: Cannot find module './index.ts' when doing npm start with a package import · javascript · node.js · npm · npm-install · package.json....
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
The module (package) not found is always specified in the format "Module not found: Error: Can't resolve 'package name' in 'project directory".
Read more >
I have an error it says: Error: Cannot find module '.env'
[nodemon] starting node ./index.js node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module '.env' Require stack: ...
Read more >
Error: Cannot find module - Render community
Hello community, I have a problem with my first deployment of the express application in render.com, the console shows an error Error: The ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found