pnpm / action-setup

Install pnpm package manager
https://github.com/marketplace/actions/setup-pnpm
MIT License
939 stars 89 forks source link

Action failing with setup that has previously been working #135

Closed Carson-JG closed 4 months ago

Carson-JG commented 4 months ago

Getting the following error when running action. Action was working yesterday, and has worked for almost a year.

Running self-installer...
   WARN  GET https://registry.npmjs.org/pnpm error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
   WARN  GET https://registry.npmjs.org/pnpm error (ERR_INVALID_THIS). Will retry in 1 minute. 1 retries left.
   ERR_PNPM_META_FETCH_FAIL  GET https://registry.npmjs.org/pnpm: Value of "this" must be of type URLSearchParams
Error: Something went wrong, self-installer exits with code 1
Installation Completed!

This is our setup:

      - name: Install pnpm
        uses: pnpm/action-setup@v2
        with:
          version: latest
shreyas-iyer commented 4 months ago

Seeing this as well with version: 8.11.0. Was totally fine a couple hours ago.

haq204 commented 4 months ago

can confirm seeing the issue as on 8.11.0

fvictorio commented 4 months ago

Upgrading the action to v4 seems to fix this:

        uses: pnpm/action-setup@v4
craftyc0der commented 4 months ago

upgrading to v4 fixes this for me

jmcgrath207 commented 4 months ago

Upgrading the action to v4 seems to fix this:

        uses: pnpm/action-setup@v4

This fix worked when jumping from pnpm/action-setup@v2 . Thanks @fvictorio !

chris24sahadeo commented 4 months ago

Also got this error on v2. v4 fixes it

nhuray commented 4 months ago

We also upgrade to v4 and it resolves the issue !

jieey1140 commented 4 months ago
        uses: pnpm/action-setup@v4.0.0

This was also resolved on Ubuntu 22.04 + k8s self-host-runner by upgrading the pnpm-action version to 4.0.0 !

Thank you! @fvictorio

dvins commented 4 months ago

Appreciate that upgrading to v4.0.0 may solve the problem, but addressing this in dozens of GitHub workflows on a US Holiday is a nightmare. To say nothing of dozens of broken builds that cannot be reinitiated after the workflow change. What caused this to break? Can it be restored?

alokVishu commented 4 months ago

image

cactusanil commented 4 months ago

This fix worked when jumping from pnpm/action-setup@v2 . Thanks @fvictorio !

dvins commented 4 months ago

This fix worked when jumping from pnpm/action-setup@v2 . Thanks @fvictorio !

Unfortunately it's not a fix, its a work around that only affects new workflow runs. In our case, we have dozens of GitHub workflows in a stuck state because of whatever deprecated the ability to use v2 version did so without warning. Upgrading to v4 action does not solve the problem because there is no way to affect the stuck GitHub workflow instances.

liby commented 4 months ago

Appreciate that upgrading to v4.0.0 may solve the problem, but addressing this in dozens of GitHub workflows on a US Holiday is a nightmare. To say nothing of dozens of broken builds that cannot be reinitiated after the workflow change. What caused this to break? Can it be restored?

It seems that this issue may be related to the fetch API. Currently, pnpm/action-setup@v2 is using Node.js@v16, which has reached its EOL. It is also possible that GitHub Actions have abandoned the use of this version and fallback to a higher version. The above is just speculation.

bobinfra1006 commented 4 months ago

I change my pnpm/action-setup@v4,but still error。 Error: Multiple versions of pnpm specified: Error: Error: Multiple versions of pnpm specified:

RihanArfan commented 4 months ago

It seems that this issue may be related to the fetch API. Currently, pnpm/action-setup@v2 is using Node.js@v16, which has reached its EOL. It is also possible that GitHub Actions have abandoned the use of this version and fallback to a higher version. The above is just speculation.

Adding to this, GitHub deprecated Node.js v16 (EOL) last year and there should've been warnings since 23 Oct 2023. https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/

To stop this from happening again, setup Dependabot/Renovate to update your GitHub Actions.

liby commented 4 months ago

It seems that this issue may be related to the fetch API. Currently, pnpm/action-setup@v2 is using Node.js@v16, which has reached its EOL. It is also possible that GitHub Actions have abandoned the use of this version and fallback to a higher version. The above is just speculation.

Adding to this, GitHub deprecated Node.js v16 (EOL) last year and there should've been warnings since 23 Oct 2023. github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20

To stop this from happening again, setup Dependabot/Renovate to update your GitHub Actions.

According to the latest related GitHub Actions Blog mentioned:

On June 30th 2024, we will change the default from Node16 to Node20. To opt out of this and continue using Node16 while it is still available in the runner, you can choose to set ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true

But the statement here is still ambiguous, without clarifying whether if using: node16 is set but ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true is not set, will this Actions runner fallback to node20 or use node16.

funayamateppei commented 4 months ago

@bobinfra1006

I change my pnpm/action-setup@v4,but still error. Error: Multiple versions of pnpm specified: Error: Error: Multiple versions of pnpm specified:

  • version 8.11.0 in the GitHub Action config with the key "version"
  • version pnpm@9.0.6 in the package.json with the key "packageManager" Remove one of these versions to avoid version mismatch errors like ERR_PNPM_BAD_PM_VERSION
  • version 8.11.0 in the GitHub Action config with the key "version"
  • version pnpm@9.0.6 in the package.json with the key "packageManager" Remove one of these versions to avoid version mismatch errors like ERR_PNPM_BAD_PM_VERSION at readTarget (/home/runner/work/_actions/pnpm/action-setup/v4/dist/index.js:1:4528) at runSelfInstaller (/home/runner/work/_actions/pnpm/action-setup/v4/dist/index.js:1:3742) at async install (/home/runner/work/_actions/pnpm/action-setup/v4/dist/index.js:1:2976) at async main (/home/runner/work/_actions/pnpm/action-setup/v4/dist/index.js:1:444)

Here is a possible issue where the pnpm version specified in the package.json does not match the version specified in the GitHub Action configuration. I encountered the same issue, but I was able to resolve it by aligning the pnpm version specified in the package.json with the version specified in the GitHub Actions configuration.

pierre-charles commented 4 months ago

To add to this, this was suggested several pipelines, I noticed it yesterday and left it my todo list only to then realise it had to be done very soon

Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: pnpm/action-setup@v2

martin-luo commented 4 months ago

Upgrading the action to v4 seems to fix this:

        uses: pnpm/action-setup@v4

Upgrading to v4 works for us, thanks @fvictorio !

sonam-serchan commented 4 months ago

Failed with pnpm version:9 as well for us.

Upgrading action to 4 worked!!!

zkochan commented 4 months ago

It must be an issue with a newer Node.js version. I remember fixing the same error in pnpm. But I am afraid to touch the v2 version of this action. Better to upgrade it in your action (or downgrade Node.js).

zkochan commented 4 months ago

I can upgrade the pnpm bundled with the v2 of action to v7 but in that case it will stop working with node.js v12: https://github.com/pnpm/action-setup/pull/138

zkochan commented 4 months ago

Fixed in 2.4.1 https://github.com/pnpm/action-setup/releases/tag/v2.4.1

CollinHerber commented 4 months ago

Are we getting a fix for this in the v4 and v3 versions of the action? I am seeing this with 9.4.0 of pnpm and v4 of the action.

zkochan commented 4 months ago

This issue was reproducible only in v2 of the action as far as I can tell. As you can see, everyone is upgrading to v4 to fix the issue.

nubunto commented 4 months ago

only the modern javascript ecosystem can have software be broken absolutely out of nowhere

CollinHerber commented 4 months ago

I've triple checked that I'm using v4 . I'm even using the direct commit hash instead of just v4 and still seeing this.

zkochan commented 4 months ago

@CollinHerber do you have a link to the action? If no, you can just use corepack instead to install pnpm. Like here:

https://github.com/pnpm/pnpm.io/blob/6e37a4afdf6cac6dbe37b8e3aea709ce85efaa77/.github/workflows/ci.yml#L19-L22

quantuminformation commented 3 months ago

any quick fix for

image
StefanMorar commented 1 month ago

We previously used pnpm version 7 (7.30.3) with pnpm/action-setup@v3. Updating the action to pnpm/action-setup@v4 alone did not fix the registry.npmjs errors.

We had to update the pnpm version too. Using pnpm 8 (8.15.9) with pnpm/action-setup@v4 fixed the errors.