Skip to content

next.js cannot find pages folder after building for Firebase functions #8926

@ghost

Description

Bug report

Describe the bug

https://github.com/zeit/next.js/tree/canary/examples/with-firebase-hosting-and-typescript

Next.js cannot find pages folder after building and deploy to firebase functions.
Next.js v9.0.6 seems fine. It works well. but since v9.0.7 Next.js is not.

> protobufjs@6.8.8 postinstall C:\test\test-web\your-app\dist\functions\node_modules\protobufjs
> node scripts/postinstall

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN with-firebase-hosting-and-typescript@1.0.0 No repository field.
npm WARN with-firebase-hosting-and-typescript@1.0.0 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.0 (node_modules\firebase-tools\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.0: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 1323 packages from 618 contributors and audited 13608 packages in 25.735s
found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
+  functions: Finished running predeploy script.
Running command: npm run build-public

> with-firebase-hosting-and-typescript@1.0.0 build-public C:\test\test-web\your-app
> cpx "sources/public/**/*.*" "dist/public" -C

+  hosting: Finished running predeploy script.
i  functions: ensuring necessary APIs are enabled...
+  functions: all necessary APIs are enabled
i  functions: preparing dist/functions directory for uploading...

Error: Error occurred while parsing your function triggers.

Error: > Couldn't find a `pages` directory. Please create one under the project root
    at findPagesDir (C:\test\test-web\your-app\dist\functions\node_modules\next\dist\lib\find-pages-dir.js:3:170)
    at new DevServer (C:\test\test-web\your-app\dist\functions\node_modules\next\dist\server\next-dev-server.js:1:2679)
    at Object.createServer [as default] (C:\test\test-web\your-app\dist\functions\node_modules\next\dist\server\next.js:2:105)
    at Object.<anonymous> (C:\test\test-web\your-app\dist\functions\index.js:16:27)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)

Having trouble? Try firebase deploy --help
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

npx create-next-app --example with-firebase-hosting-and-typescript your-app
-> edit .firebaserc
{ "projects" : { "default" : "YOUR_PROJECT" } }

firebase use default
npm run deploy

Expected behavior

Next.js App should be deployed to Firebase function.

System information

Google Firebase Functions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions