<h1 dir="auto">Bug report</h1>
<h2 dir="auto">Describe the bug</h2>
<p dir="auto"><a href="https://github.com/zeit/next.js/tree/canary/examples/with-firebase-hosting-and-typescript">https://github.com/zeit/next.js/tree/canary/examples/with-firebase-hosting-and-typescript</a></p>
<p dir="auto">Next.js cannot find pages folder after building and deploy to firebase functions.<br>
Next.js v9.0.6 seems fine. It works well. but since v9.0.7 Next.js is not.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; protobufjs@6.8.8 postinstall C:\test\test-web\your-app\dist\functions\node_modules\protobufjs
&gt; 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 {&quot;os&quot;:&quot;darwin&quot;,&quot;arch&quot;:&quot;any&quot;} (current: {&quot;os&quot;:&quot;win32&quot;,&quot;arch&quot;:&quot;x64&quot;})
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 {&quot;os&quot;:&quot;darwin&quot;,&quot;arch&quot;:&quot;any&quot;} (current: {&quot;os&quot;:&quot;win32&quot;,&quot;arch&quot;:&quot;x64&quot;})

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

&gt; with-firebase-hosting-and-typescript@1.0.0 build-public C:\test\test-web\your-app
&gt; cpx &quot;sources/public/**/*.*&quot; &quot;dist/public&quot; -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: &gt; 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.&lt;anonymous&gt; (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."><pre class="notranslate"><code class="notranslate">&gt; protobufjs@6.8.8 postinstall C:\test\test-web\your-app\dist\functions\node_modules\protobufjs
&gt; 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

&gt; with-firebase-hosting-and-typescript@1.0.0 build-public C:\test\test-web\your-app
&gt; 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: &gt; 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.&lt;anonymous&gt; (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.
</code></pre></div>
<h2 dir="auto">To Reproduce</h2>
<p dir="auto">Steps to reproduce the behavior, please provide code snippets or a repository:</p>
<p dir="auto">npx create-<a class="issue-link js-issue-link notranslate" rel="noopener noreferrer nofollow" href="https://linear.app/vercel/issue/NEXT-app">next-app</a> --example with-firebase-hosting-and-typescript your-app<br>
-&gt; edit .firebaserc<br>
{ "projects" : { "default" : "YOUR_PROJECT" } }</p>
<p dir="auto">firebase use default<br>
npm run deploy</p>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">Next.js App should be deployed to Firebase function.</p>
<h2 dir="auto">System information</h2>
<p dir="auto">Google Firebase Functions</p>
<h1 dir="auto">Bug report</h1>
<p dir="auto">My project has a custom structure but so far it worked pretty well. Since I updated to v9.0.7 I get this error:</p>
<p dir="auto"><code class="notranslate">Error: &gt; Couldn't find a </code>pages<code class="notranslate">directory. Please create one under the project root at Object.findPagesDir [...]</code></p>
<p dir="auto">So far running <code class="notranslate">next src/app</code> worked just fine. Is there anything different I should do now?</p>
<h2 dir="auto">Screenshot</h2>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/28128/65817775-8d9e7300-e20b-11e9-9438-870d10cdb810.png"><img src="https://user-images.githubusercontent.com/28128/65817775-8d9e7300-e20b-11e9-9438-870d10cdb810.png" alt="image" style="max-width: 100%;"></a></p>
<h2 dir="auto">System information</h2>
<ul dir="auto">
<li>OS: [macOS]</li>
<li>Version of Next.js: [9.0.7]</li>
</ul>