-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Global CSS cannot be imported from files other than your Custom <App>" error in pages/_app.js when files are not owned by the user running Next.js #22806
Comments
I had this same issue when using docker-compose and a Another symptom of it was that next.js wasn't finding my pages directory at all and was issuing 404's. Removing the |
Some notes I have after digging into this: The problem appears to be that when Quickly looking at the code that produces this error message, it appears that when Next.js uses webpack to build CSS files I'm not yet sure why the error doesn't happen earlier if or when another loader is run (where webpack might throw an exception and give a more descriptive error message) since I still have to look deeper into how Next.js's code interacts with webpack. |
is there a solution for this? 😢 |
I haven't been able to use Next.js recently or have had a chance to look into this more (there's been new releases/changes since I created this ticket). The way to mitigate this (if the error is happening because of Unix user permissions) would be to make sure that every file and directory in the project is owned and writable by the user that will build and/or run it (i.e. no read-only filesystems, |
hey @andrew-fuchs thank you so much for your solution but I have just updated to the latest version 11.1.2 and looks like it is fixed 😄 |
Closing as this should be resolved in the latest version per above |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
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
andnext 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: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-next-app
next build
will be run as a different user than the one that owns the project's filesnext build
in some other way (making sure that the files are still owned by a different user than the one performing the build)The text was updated successfully, but these errors were encountered: