Trying to push a React app to git fails because babel's package name is too big

Viewed 80

I am trying to push a React app I've been working on to git. I have never had this issue occur before, but apparently one of the babel packages is too big. This is the error I'm getting:

error: open("babel-preset-react-app/node_modules/@babel/preset-env/node_modules/@babel/plugin-proposal-nullish-coalescing-operator/node_modules/@babel/core/lib/config/validation/option-assertions.js"): Filename too long
error: unable to index file 'babel-preset-react-app/node_modules/@babel/preset-env/node_modules/@babel/plugin-proposal-nullish-coalescing-operator/node_modules/@babel/core/lib/config/validation/option-assertions.js'
fatal: adding files failed

Is it ok if I ignore this file? Why is the name so long that I can't push it to github?

2 Answers

Try this git config core.longpaths true. It will allow git to handle long filenames.

If you use a Windows system, this may relate to a Windows restriction with length of the names in the system. Try to change record in register for Windows 10 to allow long pass:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
  • Key: LongPathsEnabled
  • Cange value from 0 to 1
Related