Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hvisser opened this issue Jul 13, 2023 · 19 comments · Fixed by #6300 or #6367
Closed

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

hvisser opened this issue Jul 13, 2023 · 19 comments · Fixed by #6300 or #6367
Assignees

Comments

@hvisser
Copy link
Contributor

hvisser commented Jul 13, 2023

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.

@hvisser
Copy link
Contributor Author

hvisser commented Jul 13, 2023

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)

@aalej aalej added the firepit label Jul 14, 2023
@joehan joehan self-assigned this Jul 18, 2023
@VictorUvarov
Copy link

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

@hvisser
Copy link
Contributor Author

hvisser commented Jul 19, 2023

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.

@hvisser
Copy link
Contributor Author

hvisser commented Aug 8, 2023

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

@cookii-king
Copy link

😕 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

@hvisser
Copy link
Contributor Author

hvisser commented Aug 21, 2023

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 😅 )

@hvisser
Copy link
Contributor Author

hvisser commented Aug 21, 2023

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.

@joehan
Copy link
Contributor

joehan commented Aug 25, 2023

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

@hvisser
Copy link
Contributor Author

hvisser commented Aug 25, 2023

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

@Masterxilo
Copy link

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

@joehan
Copy link
Contributor

joehan commented Sep 5, 2023

@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

@hvisser
Copy link
Contributor Author

hvisser commented Sep 17, 2023

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

@gkhnyrdm
Copy link

anyone fix this issue?

@tdelam
Copy link

tdelam commented Sep 25, 2023

Receiving this issue as well

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

@tdelam
Copy link

tdelam commented Sep 25, 2023

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.

@eszabo12
Copy link

eszabo12 commented Dec 25, 2023

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

v21.5.0
12.4.7

@joehan
Copy link
Contributor

joehan commented Dec 26, 2023

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

@eszabo12
Copy link

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

@joehan
Copy link
Contributor

joehan commented Dec 28, 2023

@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