Skip to content
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

Non-writable pages/_app breaks build #24772

Closed
elado opened this issue May 4, 2021 · 2 comments · Fixed by #24849
Closed

Non-writable pages/_app breaks build #24772

elado opened this issue May 4, 2021 · 2 comments · Fixed by #24849
Labels
good first issue Easy to fix issues, good for newcomers
Milestone

Comments

@elado
Copy link

elado commented May 4, 2021

What version of Next.js are you using?

10.2.0

What version of Node.js are you using?

14.15

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

Other

Describe the Bug

In environments that make files non-writable like Bazel, builds break with

Failed to compile.

./src/<file>.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://nextjs.org/docs/messages/css-global
Location: src/pages/_app.tsx

This is due to checking if pages/_app isWritable:

if (await isWriteable(pagePath)) {

which ends up making customAppFile = null even when the file exists.

Is there a reason to check if file is writable and not just if it exists?

Expected Behavior

Expected build not to fail even if pages/_app is not writable

To Reproduce

Remove write permission on pages/_app:

chmod -w pages/_app.js
@elado elado added the bug Issue was opened via the bug report template. label May 4, 2021
@timneutkens timneutkens added good first issue Easy to fix issues, good for newcomers kind: bug and removed bug Issue was opened via the bug report template. labels May 4, 2021
@timneutkens timneutkens added this to the backlog milestone May 4, 2021
@evanxd
Copy link

evanxd commented May 5, 2021

Not sure why to check if a file is writable in the findPageFile function, but it looks like we should check if it exists instead of checking if it is writable there.

@balazsorban44
Copy link
Member

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.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Easy to fix issues, good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants