My React app is crashing due to an ENOENT error and I am having trouble fixing it

76 views Asked by At

I'm building my portfolio using npx create-react-app and periodically it will crash. In the terminal, this error appears (Xs for privacy):

/Users/XXXXXXX/Library/Mobile Documents/com~apple~CloudDocs/XXXXXXXX/Projects/portfolio/node_modules/react-scripts/scripts/start.js:19 throw err; ^

[Error: ENOENT: no such file or directory, stat '/Users/XXXXXXXX/Library/Mobile Documents/com~apple~CloudDocs/XXXXXXXX/Projects/portfolio/node_modules/.cache/default-development/1.pack'] { errno: -2, code: 'ENOENT', syscall: 'stat', path: '/Users/XXXXXXXX/Library/Mobile Documents/com~apple~CloudDocs/XXXXXXXX/Projects/portfolio/node_modules/.cache/default-development/1.pack' }

Node.js v21.2.0

I have used npm cache clean --force and npm install. My app will work for a while and then crash again due to the same error code.

I looked into where the error is being thrown in my node_modules/react-scripts/scripts/start.js and this is what comes up:

// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
  throw err;
});

Hoping for help!

0

There are 0 answers