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.

Babel runtime fail after react-scripts update to 2.1.8 (tests fail)

See original GitHub issue

Is this a bug report?

YES

After I upgraded from 2.1.5 to 2.1.8, my tests (with Jest) fail, giving the same error with each run.

Cannot find module '/Users/lukasz/projects/***/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/interopRequireDefault' from 'user-button.test.tsx'

at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:221:17)
at Object.<anonymous> (src/app/layout/user-button/user-button.test.tsx:3:30)

Downgrade to 2.1.5 fixes the problem. Also app works properly, only tests fail

Did you try recovering your dependencies?

Yes

Environment

Environment Info:

  System:
    OS: macOS 10.14.4
    CPU: x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 10.15.1 - ~/.nvm/versions/node/v10.15.1/bin/node
    Yarn: 1.13.0 - ~/.nvm/versions/node/v10.15.1/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v10.15.1/bin/npm
  Browsers:
    Chrome: 73.0.3683.103
    Safari: 12.1
  npmPackages:
    react: ^16.8.6 => 16.8.6 
    react-dom: ^16.8.6 => 16.8.6 
    react-scripts: ^2.1.8 => 2.1.8 
  npmGlobalPackages:
    create-react-app: 2.1.8

Package json:

"dependencies": {
        "@rematch/core": "^1.1.0",
        "classnames": "^2.2.6",
        "downloadjs": "^1.4.7",
        "formik": "^1.5.2",
        "history": "^4.9.0",
        "include-media": "^1.4.9",
        "include-media-export": "^1.0.3",
        "leaflet": "^1.4.0",
        "lodash": "^4.17.11",
        "moment": "^2.24.0",
        "react": "^16.8.6",
        "react-compound-slider": "^1.2.1",
        "react-dom": "^16.8.6",
        "react-leaflet": "^2.2.1",
        "react-redux": "^7.0.1",
        "react-router": "^5.0.0",
        "react-router-dom": "^5.0.0",
        "react-scripts": "^2.1.5",
        "react-testing-library": "^6.1.2",
        "recompose": "^0.30.0",
        "reselect": "^4.0.0",
        "typescript": "^3.4.3",
        "use-media": "^1.3.0",
        "yup": "^0.26.10"
    },
"devDependencies": {
        "@types/classnames": "^2.2.7",
        "@types/downloadjs": "^1.4.1",
        "@types/jest": "23.3.13",
        "@types/leaflet": "^1.4.3",
        "@types/lodash": "^4.14.120",
        "@types/react": "^16.8.10",
        "@types/react-dom": "^16.8.3",
        "@types/react-leaflet": "^2.2.1",
        "@types/react-redux": "^7.0.6",
        "@types/react-router-dom": "^4.3.1",
        "@types/recompose": "^0.30.5",
        "@types/yup": "^0.26.9",
        "husky": "^1.3.1",
        "jest-dom": "^3.1.2",
        "lint-staged": "^8.1.3",
        "node-sass": "^4.11.0",
        "prettier": "^1.16.4",
        "tslint": "^5.12.1",
        "tslint-react": "^3.6.0"
    },

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:27 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
mrmckebcommented, Apr 24, 2019

That would help, @maracuja-juice. We need more information, so we can understand where the issue is coming from.

1reaction
panmonacommented, Apr 23, 2019

For me I didn’t have this issue before using CRA 3 but the error is a bit different (can’t find it from setupTests) so I think it’s more related to https://github.com/facebook/create-react-app/issues/6398 I was able to use the workaround described in that other thread and a straight downgrade didn’t help unfortunately.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parsing error: Cannot find module '@babel/preset-react'
After trying to figure this one out for a few hours, replacing @babel/preset-react with babel-preset-react-app finally worked.
Read more >
babel/preset-react
Automatic runtime (since v7.9.0 ) adds the functionality for these plugins automatically when the development option is enabled. If you have automatic runtime...
Read more >
react warning > @testing-library/user-event@13.5.0 ... - You.com
The workaround to the Warning: It looks like you're using the wrong act() around your test interactions. console error is to add the...
Read more >
react-scripts - npm
react -scripts. This package includes scripts and configuration used by Create React App. Please refer to its documentation:.
Read more >
Error: Couldn't find any versions for "@dhis2-ui/button" that ...
after have install all d2/ci d2/ui as refer, when create test app, ... @dhis2/app-shell > react-scripts > babel-jest > @jest/transform ...
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