Skip to content

is:npm hidden command is broken due to invalid config arguments (duplicate config) #6132

Description

@hvisser

I'm using the (hidden) is:npm function to check the latest available version of firebase-tools in my Github action.
I understand that this might be a bit on the edge of supported, however the is:npm function in firepit seems broken at the moment, which is probably not intended :)

[REQUIRED] Environment info

firebase-tools:

firebase-tools standalone 12.4.4

Platform:

ubuntu, did not test on other platforms, but could be equally affected.

[REQUIRED] Test case

run firebase is:npm

[REQUIRED] Steps to reproduce

run firebase is:npm

[REQUIRED] Expected behavior

Calls the embedded npm

[REQUIRED] Actual behavior

Returns an error similar to

Error: double-loading config "/home/botteaap/.cache/firebase/runtime/npmrc" as "global", previously loaded as "user"
    at Config.#loadObject (/snapshot/firepit/node_modules/npm/node_modules/@npmcli/config/lib/index.js:571:13)
    at /snapshot/firepit/node_modules/npm/node_modules/@npmcli/config/lib/index.js:617:31
    at async Config.#loadFile (/snapshot/firepit/node_modules/npm/node_modules/@npmcli/config/lib/index.js:616:5)
    at async Config.load (/snapshot/firepit/node_modules/npm/node_modules/@npmcli/config/lib/index.js:287:5)
    at async Npm.#load (/snapshot/firepit/node_modules/npm/lib/npm.js:195:5)
    at async /snapshot/firepit/node_modules/npm/lib/cli-entry.js:40:5

The root cause seems to be that the same npmrc is passed to npm here https://github.com/firebase/firebase-tools/blob/master/standalone/firepit.js#L186 which apparently is no longer allowed.

Activity

  1. hvisser commented on Jul 13, 2023

    @hvisser
    ContributorAuthor

    Actually, this seems a bit more severe as I'm also seeing the same error when running firebase deploy with the standalone version (at the point where it's calling out to run npm run lint)

  2. self-assigned this
    on Jul 18, 2023
  3. VictorUvarov commented on Jul 19, 2023

    @VictorUvarov

    Is there a temporary workaround to this issue? Should I downgrade firebase-tools?

  4. hvisser commented on Jul 19, 2023

    @hvisser
    ContributorAuthor

    I've downgraded to 12.4.3 which doesn't have this bug. I also reproduced this on mac os in the mean time. My function deploys were failing with 12.4.4 because of this too.

  5. hvisser commented on Aug 8, 2023

    @hvisser
    ContributorAuthor

    Any updates on this maybe? I'm stuck on 12.4.3 because my functions do not deploy with the the firepit version.

  6. cookii-king commented on Aug 18, 2023

    @cookii-king

    😕 I'm experiencing the same issue as well. I was really looking forward to testing out the new v2, but unfortunately, I'm encountering difficulties deploying the function.

    Screenshot 2023-08-18 at 15:49:38

  7. hvisser commented on Aug 21, 2023

    @hvisser
    ContributorAuthor

    I was attempting a PR to fix this, but it seems like bumping the npm dependency is the root cause (v12.4.3...v12.4.4#diff-c9a00aafb0c4dc8ec395ea49f9fbb6482f757b31adee758cb59ad4e27118ae52). Even if I remove the duplicate config line that I linked to, I'm not getting any output running firebase is:npm help. When I downgrade the npm dependency things start working again. @joehan I hope you have any ideas and that this info is useful to you?

    @cookii-king The only workaround so far, if you want to use the standalone version of the firebase cli, is to stick to version 12.4.3 https://firebase.tools/ has instructions on how to get a specific version. The version installed through npm doesn't have this issue (I think, I hope 😅 )

  8. hvisser commented on Aug 21, 2023

    @hvisser
    ContributorAuthor

    Digging a bit deeper, there are errors when running the npm pkg step. Those in turn are related to vercel/pkg#1291. The newer npm dependency uses esm modules. What seems to be happening is that not all dependencies used for the npm cli are compiled correctly, hence the broken npm. The built-in node version using is:node also seems broken by the way.

    --edit-- I looked further into this, and the repackaged npm is indeed broken and throws an exception that is normally not shown. Tried some things to fix that packaging but I nothing that is working yet.

    I guess the short term solution would be to revert the npm dependency bump which would unbreak standalone versions of firebase-tools after 12.4.3.

  9. joehan commented on Aug 25, 2023

    @joehan
    Member

    @hvisser Thanks for all the research into this, I'm looking into a fix now (hopefully without going all the way back to npm 6.x). Apologies for the delay on this - I had deprioritized it in my head since is:npm isn't an officially supported command, but since this seems to affect any call to npm from the standalone version of the CLI, it is much more concerning.

  10. hvisser commented on Aug 25, 2023

    @hvisser
    ContributorAuthor

    Thanks @joehan I didn't realise that either when I filed the issue initially, so I completely understand.

  11. Masterxilo commented on Sep 3, 2023

    @Masterxilo

    I had the same problem today. Installing via "curl -sL https://firebase.tools | bash" we apparently still get a bad version...

  12. joehan commented on Sep 5, 2023

    @joehan
    Member

    @Masterxilo There has not been a new version released since we fixed this bug, so that is expected. This should be resolved in the next version

  13. hvisser commented on Sep 17, 2023

    @hvisser
    ContributorAuthor

    @joehan Turns out this is not completely fixed, see PR #6367. LMK if you need a separate issue for that too.

  14. gkhnyrdm commented on Sep 22, 2023

    @gkhnyrdm

    anyone fix this issue?

  15. tdelam commented on Sep 25, 2023

    @tdelam

    Receiving this issue as well

    node --version && firebase --version
    v20.5.0 12.5.2

  16. tdelam commented on Sep 25, 2023

    @tdelam

    I've downgraded to 12.4.3 which doesn't have this bug. I also reproduced this on mac os in the mean time. My function deploys were failing with 12.4.4 because of this too.

    This worked for me too.

  17. elleszabo commented on Dec 25, 2023

    @elleszabo

    getting this with node --version && firebase --version

    v21.5.0
    12.4.7

  18. joehan commented on Dec 26, 2023

    @joehan
    Member

    Hey @eszabo12 - this issue was fixed in 12.6.0. Please update to a more recent version of firebase-tools.

  19. elleszabo commented on Dec 27, 2023

    @elleszabo

    Hey @eszabo12 - this issue was fixed in 12.6.0. Please update to a more recent version of firebase-tools.

    I ran
    npm update -g firebase-tools

    and am now getting this:

    firebase --version
    This tool has encountered an error. Please file a bug on Github (https://github.com/firebase/firebase-tools/) and include firepit-log.txt
    

    so it only runs with "sudo" prepended. Now am no longer getting the dual config error but instead this
    Screenshot 2023-12-27 at 1 04 44 PM

  20. joehan commented on Dec 28, 2023

    @joehan
    Member

    @eszabo12 Since that's a different error, could you open a new issue and include the firepit-log.txt file? It will be difficult to help otherwise.

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