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.

2.1.4 Update cause "Cannot find module '/Users/.../node_modules/react-scripts/node_modules/@babel/runtime/helpers/interopRequireDefault' from 'setupTests.ts'"

See original GitHub issue

Environment

 System:
    OS: macOS 10.14.2
    CPU: x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 11.6.0 - ~/.nvm/versions/node/v11.6.0/bin/node
    Yarn: 1.12.3 - ~/.nvm/versions/node/v11.6.0/bin/yarn
    npm: 6.5.0-next.0 - ~/.nvm/versions/node/v11.6.0/bin/npm
  Browsers:
    Chrome: 72.0.3626.96
    Firefox: 64.0
    Safari: 12.0.2
  npmPackages:
    react: ^16.8.1 => 16.8.1 
    react-dom: ^16.8.1 => 16.8.1 
    react-scripts: ^2.1.4 => 2.1.4 
  npmGlobalPackages:
    create-react-app: Not Found

Steps to Reproduce

Starting from my project with react-scripts: 2.1.3,

  • yarn
  • yarn test working
  • yarn add react-scripts@2.1.4
  • yarn test working
  • yarn-deduplicate what is this

Introducing these modifications in the yarn.lock

-"@babel/plugin-transform-destructuring@7.3.2":
+"@babel/plugin-transform-destructuring@7.3.2", "@babel/plugin-transform-destructuring@^7.0.0", "@babel/plugin-transform-destructuring@^7.2.0":
   version "7.3.2"
 
-"@babel/plugin-transform-destructuring@^7.0.0", "@babel/plugin-transform-destructuring@^7.2.0":
-  version "7.2.0"
-

-ajv@^6.1.0, ajv@^6.5.3, ajv@^6.5.5:
-  version "6.7.0"
-
-ajv@^6.9.1:
+ajv@^6.1.0, ajv@^6.5.3, ajv@^6.5.5, ajv@^6.9.1:
   version "6.9.1"

-autoprefixer@^9.3.1:
-  version "9.4.6"
-
-autoprefixer@^9.4.2:
+autoprefixer@^9.3.1, autoprefixer@^9.4.2:
   version "9.4.7"

-caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000884, caniuse-lite@^1.0.30000929:
-  version "1.0.30000929"
-
-caniuse-lite@^1.0.30000918, caniuse-lite@^1.0.30000932:
+caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000884, caniuse-lite@^1.0.30000918, caniuse-lite@^1.0.30000929, caniuse-lite@^1.0.30000932:
   version "1.0.30000936"

-core-js@2.6.4:
+core-js@2.6.4, core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.0, core-js@^2.5.7:
   version "2.6.4"
 
-core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.0, core-js@^2.5.7:
-  version "2.6.3"
-

-postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.13, postcss@^7.0.2, postcss@^7.0.5:
-  version "7.0.13"
-
-postcss@^7.0.14, postcss@^7.0.6:
+postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.2, postcss@^7.0.5, postcss@^7.0.6:
   version "7.0.14"

-react-error-overlay@^5.1.0:
-  version "5.1.2"
-
-react-error-overlay@^5.1.3:
+react-error-overlay@^5.1.0, react-error-overlay@^5.1.3:
   version "5.1.3"

-resolve@1.10.0, resolve@^1.9.0:
+resolve@1.10.0, resolve@^1.1.6, resolve@^1.1.7, resolve@^1.2.0, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.6.0, resolve@^1.8.1, resolve@^1.9.0:
   version "1.10.0"
 
-resolve@^1.1.6, resolve@^1.1.7, resolve@^1.2.0, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.6.0, resolve@^1.8.1:
-  version "1.9.0"
-
  • yarn
  • yarn test not working anymore
 Test suite failed to run

    Cannot find module '/Users/.../node_modules/react-scripts/node_modules/@babel/runtime/helpers/interopRequireDefault' from 'setupTests.ts'

      1 | import { configure } from 'enzyme';
      2 | import Adapter from 'enzyme-adapter-react-16';
    > 3 | import 'jest-extended';
        |                              ^
      4 | import 'jest-localstorage-mock';
      5 | import { getSnapshotDiffSerializer, toMatchDiffSnapshot } from 'snapshot-diff';
      6 | 

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:221:17)
      at Object.<anonymous> (src/setupTests.ts:3:30)

If needed I’ll try to make a reproductible demo. My actual project is for work (and not open-source…).

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:39
  • Comments:57 (6 by maintainers)

github_iconTop GitHub Comments

110reactions
antzhdanovcommented, Apr 25, 2019

For me, upgrading to 2.1.8 did not help. What did help though, is running tests with --clearCache:

$ yarn test --clearCache

Hope this helps. See https://jestjs.io/docs/en/cli.html#clearcache for details

51reactions
jeremyckahncommented, Feb 11, 2019

I was able to work around this issue with:

npm i babel-preset-react-app@7.0.0

The latest version as of this writing is 7.0.1. It appears that something related to #6393 is causing this issue.

Relevant commits:

FYI @ianschmitz. I’m not sure if this is related to your work, but your name popped up.

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 - Stack Overflow
The user ( jeremyckahn ) who posted it said this: I was able to work around this issue with: npm i babel-preset-react-app@7.0.0.
Read more >
cannot find module '@angular/core/testing' from ... - You.com
Update eslint-plugin-import manually to 2.26.0. After these steps we're getting the next error while trying to do a node test of the app:...
Read more >
ts-loader - npm
Better yet, write a test and submit it in a PR! Configuration. Create or update webpack.config.js like so: module.
Read more >
Solved: Cannot find module react : npm install - YouTube
start Windows PowerShell and use npm install.
Read more >
Changelog - Cypress Documentation
0 regression where using custom reporters would cause Cypress to throw a 'Cannot find module' error. Fixes #24607; Fixed testIsolation configuration validation ...
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