[Build] Failed to compile | Error: [BABEL] index.js Cannot find module './src/data'
See original GitHub issueThe bug itself
Getting this error when running : yarn build
Creating an optimized production build… Failed to compile.
./src/index.js Error: [BABEL] /root/my-app/src/index.js: Cannot find module ‘./src/data’ Require stack:
- /root/my-app/node_modules/core-js-compat/helpers.js
- /root/my-app/node_modules/core-js-compat/get-modules-list-for-target-version.js
- /root/my-app/node_modules/@babel/preset-env/lib/polyfills/corejs3/entry-plugin.js
- /root/my-app/node_modules/@babel/preset-env/lib/index.js
- /root/my-app/node_modules/babel-preset-react-app/create.js
- /root/my-app/node_modules/babel-preset-react-app/index.js
- /root/my-app/node_modules/@babel/core/lib/config/files/plugins.js
- /root/my-app/node_modules/@babel/core/lib/config/files/index.js
- /root/my-app/node_modules/@babel/core/lib/index.js
- /root/my-app/node_modules/babel-loader/lib/index.js
- /root/my-app/node_modules/loader-runner/lib/loadLoader.js
- /root/my-app/node_modules/loader-runner/lib/LoaderRunner.js
- /root/my-app/node_modules/webpack/lib/NormalModule.js
- /root/my-app/node_modules/webpack/lib/NormalModuleFactory.js
- /root/my-app/node_modules/webpack/lib/Compiler.js
- /root/my-app/node_modules/webpack/lib/webpack.js
- /root/my-app/node_modules/react-scripts/scripts/build.js (While processing: “/root/my-app/node_modules/babel-preset-react-app/index.js$0$29”)
My environment and project settings
node version : 12.3.1 npm version : 6.12.1 yarn version : 1.19.2
package.json
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"connected-react-router": "^6.6.0",
"hammerjs": "^2.0.8",
"is_js": "^0.9.0",
"ismobilejs": "^1.0.3",
"promise": "^8.0.3",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-redux": "^7.1.3",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-scripts": "3.2.0",
"redux": "^4.0.4",
"redux-devtools-extension": "^2.13.8",
"redux-thunk": "^2.3.0",
"sanitize.css": "^11.0.0",
"tinycolor2": "^1.4.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
machine:
Linux ary-prod 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
I tried to run the same app on an ubuntu machine with the same versions of npm yarn and node, and it works, but not on this one.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:22 (7 by maintainers)
Top Results From Across the Web
0 - Stack Overflow
Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-core' · javascript · node.js · reactjs ...
Read more >Search - appsloveworld
Coding example for the question Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module './src/data'-Reactjs.
Read more >Error: [BABEL] /opt/build/repo/src/index.tsx: Cannot find ...
Failed to compile. ./src/index.tsx Error: [BABEL] /opt/build/repo/src/index.tsx: Cannot find module '@babel/helper-call-delegate' Require stack: ...
Read more >Babel: Cannot find module - support - HUGO
This appears to be like I'm missing something really simple, but I can't ... Error building site: BABEL: failed to transform "js/bundle.js" ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hecomp there’s no instructions you can follow to resolve this currently. Please wait for npm to purge or update their edge caches!
To clarify, there is nothing we can do to fix this. Please be patient, it will resolve in time.
Once it’s resolved, you’ll need to deeply upgrade dependencies by running
yarn upgrade
.If you use
npm
, you may need to deletepackage-lock.json
and re-runnpm install
to fix it.I’ve just created a new project and it seems to work as intended now.
Edit:
Made it work in an existing project by running these steps:
npm i