Skip to content

Could not find the next executable #6173

Closed

Description

@MiftahClassifieds

Environment info node 16.16.0

npm 8.11.0

firebase-tools: 12.4.4

Platform: nextjs

Test case

Steps to reproduce:

1 create nextjs project
2 firebase init
3 firebase deploy

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.

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.

Activity

  1. google-oss-bot commented on Jul 25, 2023

    @google-oss-bot
    Collaborator

    This issue does not seem to follow the issue template. Make sure you provide all the required information.

  2. aalej commented on Jul 25, 2023

    @aalej
    Contributor

    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:

    1. Run npx create-next-app
    2. Run cd my-app
    3. Downgrade Next.js to 13.4.9
    4. Run firebase init hosting --project <project_id>
    5. 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.

  3. added
    Needs: Author Feedback
    on Jul 25, 2023
  4. malikmubashar commented on Jul 26, 2023

    @malikmubashar

    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".

  5. malikmubashar commented on Jul 26, 2023

    @malikmubashar

    [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.

  6. aalej commented on Jul 28, 2023

    @aalej
    Contributor

    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:

    1. Are you encountering a similar error message when running firebase emulators:start, or does it run without any issues?
    2. Are you able to run npm run dev or npx next dev without any issues?
    3. Does running npm i or npm install then re-deploying via firebase deploy produce a different behavior?
    4. In your node_modules directory, do you see a ./bin/next file?
  7. aacotroneo commented on Jul 28, 2023

    @aacotroneo

    More info

    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!

  8. aacotroneo commented on Jul 28, 2023

    @aacotroneo

    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.

    curl -sL firebase.tools | uninstall=true bash
    npm install -g [email protected]
    firebase deploy
  9. MiftahClassifieds commented on Jul 28, 2023

    @MiftahClassifieds
    Author

    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> `

  10. added and removed
    Needs: Author Feedback
    on Jul 28, 2023
  11. frankl1 commented on Jul 29, 2023

    @frankl1

    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.

  12. MiftahClassifieds commented on Jul 29, 2023

    @MiftahClassifieds
    Author

    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?!

  13. 15 remaining items

  14. google-oss-bot commented on Aug 29, 2023

    @google-oss-bot
    Collaborator

    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!

  15. pradeepgudipati commented on Aug 29, 2023

    @pradeepgudipati

    This issue is limited to Windows only - and changing source to public in firebase.json doesn't work.

  16. alexjmoore commented on Aug 30, 2023

    @alexjmoore

    Not sure it is limited to Windows only, I also saw issues on my ChromeOS Debian Linux environment

  17. google-oss-bot commented on Sep 8, 2023

    @google-oss-bot
    Collaborator

    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!

  18. andresuarezz26 commented on Sep 10, 2023

    @andresuarezz26

    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.

  19. davidgiesemann commented on Sep 15, 2023

    @davidgiesemann

    I had to change firebase.json so it won't ignore .next folder:

    ...
    "ignore": [
    ...,
    "**/.*", <-- Removed this line
    ...,
    ],
    ...

    This made my deployment run sucessfully!

  20. leoortizz commented on Sep 18, 2023

    @leoortizz
    Member

    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.

  21. timmyomahony commented on Mar 7, 2024

    @timmyomahony

    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-tools
    
    name: Deploy to Firebase Hosting on merge
    'on':
      push:
        branches:
          - main
    jobs:
      build_and_deploy:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - run: npm ci && npm run build
          - uses: FirebaseExtended/action-hosting-deploy@v0
            with:
              repoToken: '${{ secrets.GITHUB_TOKEN }}'
              firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_[YOUR PROJECT ID] }}'
              channelId: live
              projectId: [YOUR PROJECT ID]
            env:
                FIREBASE_CLI_EXPERIMENTS: webframeworks
  22. RickWiltvank commented on Apr 18, 2024

    @RickWiltvank

    We fixed this by using

    npm uninstall next
    
    npm install [email protected]
    
    npm install firebase-frameworks
    

    After several hours of reinstalls of different versions of node, next, firebase, firebase-tools etc (which did not work)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions