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 node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/interopRequireDefault

See original GitHub issue

Describe the bug Running npm run test command results in error: Cannot find module ‘/Users/yankovskyandrey/Code/cra-sb-storyshots-bug/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/interopRequireDefault’ from ‘Storyshots.test.js’

To Reproduce Steps to reproduce the behavior:

  1. Use npm to install all dependencies
  2. Setup CRA + storybook using this instruction https://www.learnstorybook.com/react/en/get-started/
  3. Add addon-storyshots and addon-storyshots-puppeteer by following their instructions

or just clone my repo https://github.com/Yankovsky/cra-sb-storyshots-bug and follow instructions inside

Expected behavior Everything works, tests run.

Screenshots http://s.csssr.ru/U02D248T6/2019-06-19-23-09-11-xjj9e_.jpg

Code snippets I pushed repo with that bug, just follow readme inside https://github.com/Yankovsky/cra-sb-storyshots-bug

System:

  • OS: MacOS
  • Device: Macbook Pro 2015
  • Framework: react
  • Addons: addon-actions, addon-links, addon-storyshots, addon-storyshots-puppeteer
  • Version: 5.1.8

Additional context This problem relates somehow to module resolution. npm installs @babel/runtime as a topmost dependency but as you can see on screenshot test command looks for @babel/runtime here node_modules/babel-preset-react-app/node_modules/@babel/runtime. Manually installing @babel/runtime as project dependency fixes the problem for some reason. Yarn installs @babel/runtime as babel-preset-react-app dependency so it works just fine.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

64reactions
pdemarinocommented, Dec 5, 2019

FWIW, what helped me was running jest with --clearCache. I suspect some outdated information was sitting there, that polluted all my tests.

See here for specifics

0reactions
eudisdcommented, Mar 23, 2022

–clearCache also worked for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I resolve "Cannot find module" error using Node.js?
Using npm install installs the module into the current directory only (in a subdirectory called node_modules ). Is app.js located under ...
Read more >
How to resolve can't find module error in Node.js - Reactgo
To fix Cannot find module errors, install the modules properly by running a npm install command in the appropriate directory as your project's ......
Read more >
Fix Global Installs Not Working | "Cannot find module" error FIX
Getting " Cannot find module " after installing something globally (with -g)? Well, this video shows you how to fix global package/module ...
Read more >
Error: Cannot find module 'express' - YouTube
Error: Cannot find module 'express'Error: Cannot find module 'cors'Error: Cannot find module 'body-parser'Error: Cannot find module ...
Read more >
Uncaught Error: Cannot find module "." · Issue #4921 - GitHub
I'm having this issue, but with import() :( 8 0vidiu, webdevbyjoss, hiteshgoyal18, shreyaHomelane ...
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