-
Notifications
You must be signed in to change notification settings - Fork 29.4k
Description
What version of Next.js are you using?
10.0.7 (also found in 10.0.8-canary.17)
What version of Node.js are you using?
15.11.0
What browser are you using?
N/A
What operating system are you using?
Alpine Linux 3.13 (in a Docker container on a Windows 10 host)
How are you deploying your application?
next build
and next start
Describe the Bug
When building a Docker image, where the project's files are owned by a different Unix user than the one running the build, next build
fails with the error:
./styles/globals.css
Global CSS cannot be imported from files other than your Custom <App>. Please move all global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: https://err.sh/next.js/css-global
Location: pages/_app.js
This is happening in projects where no global CSS imports exist other than those in pages/_app.js
The problem appears to be triggered when the project's files are owned by a different Unix user than the one running next build
.
Expected Behavior
next build
should run without an error, or if the correct file permissions are needed Next.js should print an error message about file permissions instead of an unrelated error about Global CSS imports.
To Reproduce
I've created a git repo to reproduce this at https://github.com/andrew-fuchs/next-js-docker-user-bug
To recreate the problem from scratch:
- Create a new project with
create-next-app
- Create a Dockerfile, such that
next build
will be run as a different user than the one that owns the project's files - Build the Docker image, or run
next build
in some other way (making sure that the files are still owned by a different user than the one performing the build)