I just created a new site from the Nextjs blog template and I’m having trouble when I run “npm run build”. Using the template with no modifications, I can deploy just fine, but when I run the build locally I get this error:
Failed to compile.
./pages/_app.js
Module not found: Can’t resolve ‘…/styles/globals.css’ in ‘C:\Users\williamsjohn\git\nextjs-blog\pages’> Build failed because of webpack errors
If I change the import to in pages/_app.js
to ./styles/globals.css
, the build works locally but fails when I deploy. The strange thing is that when I look at the deployment log, it seems to be using the exact same build command I’m running for local builds. I can work around the issue by leaving pages/_app.js
alone and copying pages/styles/globals.css
to styles/globals.css
, but that seems pretty hacky and definitely not something I should have to do.
My site name is johnwillia-ms.netlify.app
, and the github repo is at GitHub - johnw42/johnwillia-ms