You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior: deploy nextjs project to firebase hosting
Actual behavior:
[info]
Thank you for trying our early preview of Next.js support on Firebase Hosting.
During the preview, support is best-effort and breaking changes can be expected. Proceed with caution.
[error]
[error] Error: Could not find the next executable.
Reacted by B G Kavinga, Bartosz Klukaczewski, Masanori Tanimura, GuiltyRemnant, yakigac, Gerri, driveprogramming, Lucas Muñoz, Youngbum Kim and Sergey Chernov
Hi @MiftahClassifieds, thanks for reaching out to us. I’m using Next.js v13.4.9 and firebase-tools v12.4.4 to replicate this issue while waiting for the fix for #6163 to be released. So far, I haven’t encountered any issues while deploying.
Let me know if I may have made a mistake or missed anything; the steps I took were:
Run npx create-next-app
Run cd my-app
Downgrade Next.js to 13.4.9
Run firebase init hosting --project <project_id>
Run firebase deploy
Could you let us know which version of Next.js you’re using and share with us the output of running firebase deploy --debug? Passing the --debug flag provides a detailed log that we can use to check what caused the error. Please remove any PII (personal identifiable information) if needed.
Thanks for the providing the debug logs, @malikmubashar. I tried to repro this again using Next.js v13.4.12 and firebase-tools v12.4.6, but so far I have not encountered any issues running firebase deploy. I’m thinking this issue might be similar to #6187. To help us verify if the cause of this is similar to #6187, could you answer the following:
Are you encountering a similar error message when running firebase emulators:start, or does it run without any issues?
Are you able to run npm run dev or npx next dev without any issues?
Does running npm i or npm install then re-deploying via firebase deploy produce a different behavior?
In your node_modules directory, do you see a ./bin/next file?
Deploy continues to work as expected (same version I installed with the CLI)
If I had to guess it's some initialization issue in the CLI, so it won't be easy to reproduce for people that have a working firebase env, but new users will face this issue. Or maybe installing from firebasetools? Or it can be anything else, haha. it's weird!
Hi, @aalej : as you suggested to me I followed the steps you provided above with the follow config:
Next.js v13.4.9
firebase tools 12.4.4
node 16.16.0
npm 9.8.1
I install the mentionned next version both globaly -g and locally in my project:
I got same error : Could not find the next executable!
some old versions work fine as [email protected] but without internationalization (i18n) next-i18next or next-translate
when i deploy with 11.29.0 for ex .The deploy succeed but .the call to the website return 'internal error 500'
If i remove again the translation dependencies , the site become to work!
this is my log as you requested:
`PS E:\28_07_2023\m3> cd miftah
PS E:\28_07_2023\m3\miftah> firebase init
You're about to initialize a Firebase project in this directory:
E:\28_07_2023\m3\miftah
? Are you ready to proceed? Yes
? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choices. Hosting: Configure
files for Firebase Hosting and (optionally) set up GitHub Action deploys
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
? Please select an option: Use an existing project
? Select a default Firebase project for this directory: aqar-agadir (market)
i Using project aqar-agadir (market)
=== Hosting Setup
? In which region would you like to host server-side content, if applicable? us-central1 (Iowa)
? Set up automatic builds and deploys with GitHub? No
i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
Firebase initialization complete!
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Update available 12.4.4 → 12.4.6 │
│ To update to the latest version using npm, run │
│ npm install -g firebase-tools │
│ For other CLI management options, visit the CLI documentation (https://firebase.google.com/docs/cli#update-cli) │
│ │
│ │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
PS E:\28_07_2023\m3\miftah> firebase deploy
Thank you for trying our early preview of Next.js support on Firebase Hosting.
During the preview, support is best-effort and breaking changes can be expected. Proceed with caution.
Thank you for trying our early preview of Next.js support on Firebase Hosting.
During the preview, support is best-effort and breaking changes can be expected. Proceed with caution.
I found what is causing the bug: the entry mentioned in the image --> inside firebase.json
"source" : ".",
In one of my old projects, I configured a custom nextServer, the entry is defined as follows:
"source": ".next" and I was able to successfully deploy my project; but somehow I changed it to "source": ".", and I get the same error: "Could not find the following executable"
but here using the experimental firebase cli framework, even if I change to "source": ".next" I still have the same bug until I completely remove "source" but change it to "public":" ." don't call the experimental framework to do its job. So what?!
Hey @MiftahClassifieds. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Hey @MiftahClassifieds. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Hey I had the same error and solves it changing the firebase.json configuration.
I changed the "public" field from "public" to "out":
"public": "out",
That solved the issue for me.
Thanks everyone for providing detailed information about the issue. I was able to reproduce it and found that the root cause is in the build step performed by the CLI, where npm root runs multiple times. There was a 2 seconds timeout and depending on the CPU this could take longer. I submitted a fix in #6372 which will be available in the next release.
Reacted by David Giesemann, Umut Deniz Darendeli, Max Weber and DevUiAndrew
I was getting the same error from Github Actions as the OP after setting up a vanilla Next.js 13 project with Firebase CLI:
Could not find the next executable
I didn't realise that I need to manually add the build step to the automatically generated Github Action yaml files that were created as part of firebase init. I had assumed that the included custom action FirebaseExtended/action-hosting-deploy magically did that (it obviously doesn't).
So here is my updated .github/workflows/firebase-hosting-merge.yml that includes the build step - run: npm ci && npm run build and works perfectly now.
You'll need to update some of the variables for your own project:
# This file was auto-generated by the Firebase CLI# https://github.com/firebase/firebase-toolsname: Deploy to Firebase Hosting on merge'on':
push:
branches:
- mainjobs:
build_and_deploy:
runs-on: ubuntu-lateststeps:
- uses: actions/checkout@v4
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_[YOUR PROJECT ID] }}'channelId: liveprojectId: [YOUR PROJECT ID]env:
FIREBASE_CLI_EXPERIMENTS: webframeworks
Activity
google-oss-bot commentedon Jul 25, 2023
This issue does not seem to follow the issue template. Make sure you provide all the required information.
aalej commentedon Jul 25, 2023
Hi @MiftahClassifieds, thanks for reaching out to us. I’m using Next.js v13.4.9 and firebase-tools v12.4.4 to replicate this issue while waiting for the fix for #6163 to be released. So far, I haven’t encountered any issues while deploying.
Let me know if I may have made a mistake or missed anything; the steps I took were:
npx create-next-appcd my-app13.4.9firebase init hosting --project <project_id>firebase deployCould you let us know which version of Next.js you’re using and share with us the output of running
firebase deploy --debug? Passing the--debugflag provides a detailed log that we can use to check what caused the error. Please remove any PII (personal identifiable information) if needed.malikmubashar commentedon Jul 26, 2023
Exectly same issue here.
I tried more than 10 time with different projects and nextjs versions but all in vain. Always shows the same error
"Could not find the next executable".
malikmubashar commentedon Jul 26, 2023
[debug] [2023-07-26T13:58:04.741Z] ----------------------------------------------------------------------
[debug] [2023-07-26T13:58:04.745Z] Command: C:\Program Files\nodejs\node.exe C:\Users<username>\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js deploy --debug
[debug] [2023-07-26T13:58:04.746Z] CLI Version: 12.4.6
[debug] [2023-07-26T13:58:04.746Z] Platform: win32
[debug] [2023-07-26T13:58:04.746Z] Node Version: v18.16.1
[debug] [2023-07-26T13:58:04.748Z] Time: Wed Jul 26 2023 18:58:04 GMT+0900 (Time)
[debug] [2023-07-26T13:58:04.748Z] ----------------------------------------------------------------------
[debug]
[debug] [2023-07-26T13:58:04.934Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2023-07-26T13:58:04.938Z] > authorizing via signed-in user ([email protected])
[debug] [2023-07-26T13:58:04.940Z] [iam] checking project project01 for permissions ["firebase.projects.get","firebasehosting.sites.update"]
[debug] [2023-07-26T13:58:04.947Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/project01:testIamPermissions [none]
[debug] [2023-07-26T13:58:04.948Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/project01:testIamPermissions x-goog-quota-user=projects/project01
[debug] [2023-07-26T13:58:04.952Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/project01:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]}
[debug] [2023-07-26T13:58:06.730Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/project01:testIamPermissions 200
[debug] [2023-07-26T13:58:06.732Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/project01:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]}
[debug] [2023-07-26T13:58:06.735Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/project01 [none]
[debug] [2023-07-26T13:58:07.341Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/project01 200
[debug] [2023-07-26T13:58:07.342Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/project01 {"projectId":"project01","projectNumber":"","displayName":"user","name":"projects/project01","resources":{"hostingSite":"project01"},"state":"ACTIVE","etag":"--"}
[info]
Thank you for trying our early preview of Next.js support on Firebase Hosting.
During the preview, support is best-effort and breaking changes can be expected. Proceed with caution.
Documentation: https://firebase.google.com/docs/hosting/frameworks/nextjs
File a bug: https://github.com/firebase/firebase-tools/issues/new?template=bug_report.md
Submit a feature request: https://github.com/firebase/firebase-tools/issues/new?template=feature_request.md
We'd love to learn from you. Express your interest in helping us shape the future of Firebase Hosting: https://goo.gle/41enW5X
[error]
[error] Error: Could not find the next executable.
aalej commentedon Jul 28, 2023
Thanks for the providing the debug logs, @malikmubashar. I tried to repro this again using Next.js v13.4.12 and firebase-tools v12.4.6, but so far I have not encountered any issues running
firebase deploy. I’m thinking this issue might be similar to #6187. To help us verify if the cause of this is similar to #6187, could you answer the following:firebase emulators:start, or does it run without any issues?npm run devornpx next devwithout any issues?npm iornpm installthen re-deploying viafirebase deployproduce a different behavior?node_modulesdirectory, do you see a./bin/nextfile?aacotroneo commentedon Jul 28, 2023
More info
npm install -g [email protected]If I had to guess it's some initialization issue in the CLI, so it won't be easy to reproduce for people that have a working firebase env, but new users will face this issue. Or maybe installing from firebasetools? Or it can be anything else, haha. it's weird!
aacotroneo commentedon Jul 28, 2023
nevermind.. I reinstalled from https://firebase.tools/ and it doesn't work. So that seems to be the issue.
In the meantime people can install with npm and it should be fine.
MiftahClassifieds commentedon Jul 28, 2023
Hi,
@aalej : as you suggested to me I followed the steps you provided above with the follow config:
Next.js v13.4.9
firebase tools 12.4.4
node 16.16.0
npm 9.8.1
I install the mentionned next version both globaly -g and locally in my project:
I got same error : Could not find the next executable!
some old versions work fine as [email protected] but without internationalization (i18n) next-i18next or next-translate
when i deploy with 11.29.0 for ex .The deploy succeed but .the call to the website return 'internal error 500'
If i remove again the translation dependencies , the site become to work!
this is my log as you requested:
`PS E:\28_07_2023\m3> cd miftah
PS E:\28_07_2023\m3\miftah> firebase init
You're about to initialize a Firebase project in this directory:
E:\28_07_2023\m3\miftah
? Are you ready to proceed? Yes
? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choices. Hosting: Configure
files for Firebase Hosting and (optionally) set up GitHub Action deploys
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
? Please select an option: Use an existing project
? Select a default Firebase project for this directory: aqar-agadir (market)
i Using project aqar-agadir (market)
=== Hosting Setup
? In which region would you like to host server-side content, if applicable? us-central1 (Iowa)
? Set up automatic builds and deploys with GitHub? No
i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
Firebase initialization complete!
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Update available 12.4.4 → 12.4.6 │
│ To update to the latest version using npm, run │
│ npm install -g firebase-tools │
│ For other CLI management options, visit the CLI documentation (https://firebase.google.com/docs/cli#update-cli) │
│ │
│ │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
PS E:\28_07_2023\m3\miftah> firebase deploy
Thank you for trying our early preview of Next.js support on Firebase Hosting.
During the preview, support is best-effort and breaking changes can be expected. Proceed with caution.
Documentation: https://firebase.google.com/docs/hosting/frameworks/nextjs
File a bug: https://github.com/firebase/firebase-tools/issues/new?template=bug_report.md
Submit a feature request: https://github.com/firebase/firebase-tools/issues/new?template=feature_request.md
We'd love to learn from you. Express your interest in helping us shape the future of Firebase Hosting: https://goo.gle/41enW5X
Error: Could not find the next executable.
PS E:\28_07_2023\m3\miftah> firebase deploy --debug
[2023-07-28T20:26:21.871Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2023-07-28T20:26:21.876Z] > authorizing via signed-in user ([email protected])
[2023-07-28T20:26:21.878Z] [iam] checking project aqar-agadir for permissions ["firebase.projects.get","firebasehosting.sites.update"]
[2023-07-28T20:26:21.886Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/aqar-agadir:testIamPermissions [none]
[2023-07-28T20:26:21.887Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/aqar-agadir:testIamPermissions x-goog-quota-user=projects/aqar-agadir
[2023-07-28T20:26:21.892Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/aqar-agadir:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]}
[2023-07-28T20:26:22.925Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/aqar-agadir:testIamPermissions 200
[2023-07-28T20:26:22.927Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/aqar-agadir:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]}
[2023-07-28T20:26:22.934Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/aqar-agadir [none]
[2023-07-28T20:26:23.443Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/aqar-agadir 200
[2023-07-28T20:26:23.446Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/aqar-agadir {"projectId":"aqar-agadir","projectNumber":"343481120778","displayName":"market","name":"projects/aqar-agadir","resources":{"hostingSite":"aqar-agadir","realtimeDatabaseInstance":"aqar-agadir","storageBucket":"aqar-agadir.appspot.com","locationId":"us-central"},"state":"ACTIVE","etag":"1_e117d29a-45a3-4d08-9514-8f411667685a"}
Thank you for trying our early preview of Next.js support on Firebase Hosting.
During the preview, support is best-effort and breaking changes can be expected. Proceed with caution.
Documentation: https://firebase.google.com/docs/hosting/frameworks/nextjs
File a bug: https://github.com/firebase/firebase-tools/issues/new?template=bug_report.md
Submit a feature request: https://github.com/firebase/firebase-tools/issues/new?template=feature_request.md
We'd love to learn from you. Express your interest in helping us shape the future of Firebase Hosting: https://goo.gle/41enW5X
Error: Could not find the next executable.
PS E:\28_07_2023\m3\miftah> `
frankl1 commentedon Jul 29, 2023
I am facing the same problem when deploying using Github action. The deployment is working like a charm locally on my computer using firebase cli.
MiftahClassifieds commentedon Jul 29, 2023
https://firebasestorage.googleapis.com/v0/b/aqar-agadir.appspot.com/o/webIssues%2Fsource.issue.png?alt=media&token=14cd7fc7-dcf8-4b12-a48e-9e6bdeed5b6f
I found what is causing the bug: the entry mentioned in the image --> inside firebase.json
"source" : ".",
In one of my old projects, I configured a custom nextServer, the entry is defined as follows:
"source": ".next" and I was able to successfully deploy my project; but somehow I changed it to "source": ".", and I get the same error: "Could not find the following executable"
but here using the experimental firebase cli framework, even if I change to "source": ".next" I still have the same bug until I completely remove "source" but change it to "public":" ." don't call the experimental framework to do its job. So what?!
15 remaining items
google-oss-bot commentedon Aug 29, 2023
Hey @MiftahClassifieds. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
pradeepgudipati commentedon Aug 29, 2023
This issue is limited to Windows only - and changing source to public in firebase.json doesn't work.
alexjmoore commentedon Aug 30, 2023
Not sure it is limited to Windows only, I also saw issues on my ChromeOS Debian Linux environment
google-oss-bot commentedon Sep 8, 2023
Hey @MiftahClassifieds. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
andresuarezz26 commentedon Sep 10, 2023
Hey I had the same error and solves it changing the firebase.json configuration.
I changed the "public" field from "public" to "out":
"public": "out",
That solved the issue for me.
davidgiesemann commentedon Sep 15, 2023
I had to change firebase.json so it won't ignore .next folder:
...
"ignore": [
...,
"**/.*", <-- Removed this line
...,
],
...
This made my deployment run sucessfully!
leoortizz commentedon Sep 18, 2023
Thanks everyone for providing detailed information about the issue. I was able to reproduce it and found that the root cause is in the build step performed by the CLI, where
npm rootruns multiple times. There was a 2 seconds timeout and depending on the CPU this could take longer. I submitted a fix in #6372 which will be available in the next release.timmyomahony commentedon Mar 7, 2024
I was getting the same error from Github Actions as the OP after setting up a vanilla Next.js 13 project with Firebase CLI:
I didn't realise that I need to manually add the build step to the automatically generated Github Action
yamlfiles that were created as part offirebase init. I had assumed that the included custom action FirebaseExtended/action-hosting-deploy magically did that (it obviously doesn't).So here is my updated
.github/workflows/firebase-hosting-merge.ymlthat includes the build step- run: npm ci && npm run buildand works perfectly now.You'll need to update some of the variables for your own project:
RickWiltvank commentedon Apr 18, 2024
We fixed this by using
After several hours of reinstalls of different versions of node, next, firebase, firebase-tools etc (which did not work)