create-react-app: Babel runtime fail after react-scripts update to 2.1.8 (tests fail)
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"
},
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 27 (9 by maintainers)
That would help, @maracuja-juice. We need more information, so we can understand where the issue is coming from.
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.
Bump to
3.0.0.
fixes the problem