-
Notifications
You must be signed in to change notification settings - Fork 194
Description
The package.json cannot have the build: next build script or firebase function will fail to deploy. This is very reproducible and happens every time.
example package.json
"scripts": {
"dev": "next dev",
"build": "next build"
}
I've encountered this error when it's the final stages when the function is building.
Error: Could not find 'pages' directory , which is very vague and confusing, but after figuring out a lot of issues , I am perplexed why this is an issue.
I am using src/pages folder structure in NextJS.
firebase.json
{
"hosting": {
"source": ".",
"cleanUrls": true,
"ignore": ["firebase.json", "**/.*", "**/node_modules/**", "functions/"],
"rewrites": [
{
"source": "**",
"function": "ssrNextFunc"
},
{
"source": "**/**",
"function": "ssrNextFunc"
}
],
"headers": [
{
"source": "**",
"headers": [
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000; includeSubDomains; preload"
}
]
}
]
}
}
There seems to be a mismatch somewhere as if you try to override this with anything else eg. build: next build src/ it will say this command will be ignored and firebase will use it's default and deploy will work.
BUT if it's build: next build, this doesn't get ignored, so I assume this means it must be matching firebase's build script, but the frustrating thing is that this will fail the deploy, and I do not know why for the life of me.