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.

[Build] Failed to compile | Error: [BABEL] index.js Cannot find module './src/data'

See original GitHub issue

The 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


  "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": [
      "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:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:22 (7 by maintainers)

github_iconTop GitHub Comments

Timercommented, Dec 2, 2019

@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 delete package-lock.json and re-run npm install to fix it.

krckyboycommented, Dec 2, 2019

I’ve just created a new project and it seems to work as intended now.


Made it work in an existing project by running these steps:

  1. Delete node modules
  2. Delete package-lock.json
  3. npm i
Read more comments on GitHub >

github_iconTop 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 >
assign . .babelrc.js. module.exports = { presets: [ [ "@babel/ ...
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 >

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 Post

No results found

github_iconTop Related Hashnode Post

No results found