Next.js Missing File Fix
2025-07-182 turns5,213 charsgpt-4o
Summary
User encountered a Next.js development server startup issue with custom Babel configuration.
Messages
danielkliewer@Daniels-MacBook-Pro frontend % n
pm run dev
> reverie-reactor-frontend@0.1.0 dev
> next dev
▲ Next.js 14.2.30
- Local: http://localhost:3000
✓ Starting...
Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
✓ Ready in 1918ms
Using external babel configuration from /Users/danielkliewer/reverie-reactor02/src/frontend/.babelrc
⚠ It looks like there is a custom Babel configuration that can be removed.
○ Compiling /_error ...
⨯ ./src/pages/_app.js:1:1
Module not found: Can't resolve '../styles/globals.css'
> 1 | import '../styles/globals.css';
| ^
2 | import { AuthProvider } from '../context/AuthContext';
3 | import { useRouter } from 'next/router';
4 | import { useEffect } from 'react';
https://nextjs.org/docs/messages/module-not-found
GET /_app/immutable/chunks/Messages.w5lco4Bb.js 500 in 6293ms
GET /_app/immutable/chunks/RichTextInput.bITKWwgB.js 500 in 6295ms
GET /favicon/favicon.ico 500 in 6284ms
GET /_app/version.json 500 in 6284ms
GET /favicon/site.webmanifest 500 in 6283ms
GET /favicon/favicon.svg 500 in 6ms
GET /_app/version.json 500 in 4ms
GET /api/config 500 in 4ms
GET /static/favicon.png 500 in 5ms
GET /_app/immutable/nodes/34.DYV9UQ6E.js 500 in 6ms
GET /favicon/favicon.ico 500 in 4ms
GET /_app/version.json 500 in 4ms
GET /favicon/favicon.svg 500 in 3ms
GET /favicon/favicon-96x96.png 500 in 4ms
GET /_app/version.json 500 in 4ms
GET /static/favicon.png 500 in 3ms
GET /favicon/favicon.ico 500 in 3ms
GET /favicon/favicon.svg 500 in 6ms
GET /favicon/favicon-96x96.png 500 in 7ms
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: ENOENT: no such file or directory, rename '/Users/danielkliewer/reverie-reactor02/src/frontend/.next/cache/webpack/client-development-fallback/0.pack.gz_' -> '/Users/danielkliewer/reverie-reactor02/src/frontend/.next/cache/webpack/client-development-fallback/0.pack.gz'
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: ENOENT: no such file or directory, rename '/Users/danielkliewer/reverie-reactor02/src/frontend/.next/cache/webpack/client-development-fallback/0.pack.gz_' -> '/Users/danielkliewer/reverie-reactor02/src/frontend/.next/cache/webpack/client-development-fallback/0.pack.gz'
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: ENOENT: no such file or directory, rename '/Users/danielkliewer/reverie-reactor02/src/frontend/.next/cache/webpack/client-development-fallback/0.pack.gz_' -> '/Users/danielkliewer/reverie-reactor02/src/frontend/.next/cache/webpack/client-development-fallback/0.pack.gz'
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: ENOENT: no such file or directory, rename '/Users/danielkliewer/reverie-reactor02/src/frontend/.next/cache/webpack/client-development-fallback/0.pack.gz_' -> '/Users/danielkliewer/reverie-reactor02/src/frontend/.next/cache/webpack/client-development-fallback/0.pack.gz'
You're running into a few critical issues while trying to start your Next.js frontend app. Here's a breakdown of the main problems and how to fix them:
---
## ✅ **Critical Error**
```
Module not found: Can't resolve '../styles/globals.css'
```
### 📍 Location:
```js
import '../styles/globals.css';
```
in:
```
src/pages/_app.js
```
### 💥 What’s wrong:
You're importing a CSS file that **does not exist** at `../styles/globals.css` from your `_app.js`.
---
## ✅ **Fix This First**
### 🛠 Option 1: Create the missing file
Create the file `globals.css` in the `src/styles` directory (or adjust the import path accordingly).
```bash
mkdir -p src/styles
touch src/styles/globals.css
```
Then add some minimal CSS to make it valid:
```css
/* src/styles/globals.css */
body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
```
### 🛠 Option 2: Fix the import path
If your `globals.css` is somewhere else (e.g., `src/frontend/styles/globals.css`), change the import to:
```js
import '../../styles/globals.css';
```
Adjust based on the actual directory structure.
---
## ⚠️ **Additional Errors**
### 🔄 500 errors on favicon, version.json, and `RichTextInput.js`:
These are likely cascading errors due to the initial failure in `_app.js`. Once `_app.js` is fixed, most of these should resolve.
---
## ⚙️ Babel Warning
```
Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc"
```
This isn't breaking anything, but Next.js recommends **removing the `.babelrc` file** unless you have a strong reason to keep custom Babel config.
---
## 🧹 Webpack Cache Errors
These warnings:
```
Caching failed for pack: Error: ENOENT: no such file or directory...
```
are related to the `.next` cache getting corrupted.
### 🔧 Fix:
Clear the `.next` cache:
```bash
rm -rf .next
```
Then restart:
```bash
npm run dev
```
---
## ✅ Final Checklist
1. [ ] Fix or create the missing `globals.css`.
2. [ ] Delete `.next` to clear the cache.
3. [ ] (Optional) Remove `.babelrc` unless needed.
4. [ ] Rerun `npm run dev`.
Let me know if you'd like me to walk through the folder structure or generate a starter `globals.css` or `.babelrc`.
gpt-4o