pnpm / action-setup

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

MacOS 11: Something went wrong, self-installer exits with code 1 #44

Closed aminya closed 2 years ago

aminya commented 2 years ago

The action fails on MacOS 11 https://github.com/aminya/setup-cpp/runs/6601627749?check_suite_focus=true#step:5:1

Run pnpm/action-setup@v[2](https://github.com/aminya/setup-cpp/runs/6601627749?check_suite_focus=true#step:5:2)
  with:
    version: 7
    dest: ~/setup-pnpm
    run_install: null
Running self-installer...
  [stdin]:1
  <!DOCTYPE html>
  ^

  SyntaxError: Unexpected token '<'
      at new Script (vm.js:88:7)
      at createScript (vm.js:261:10)
      at Object.runInThisContext (vm.js:[3](https://github.com/aminya/setup-cpp/runs/6601627749?check_suite_focus=true#step:5:3)09:10)
      at Object.<anonymous> ([stdin]-wrapper:10:26)
      at Module._compile (internal/modules/cjs/loader.js:999:30)
      at evalScript (internal/process/execution.js:9[4](https://github.com/aminya/setup-cpp/runs/6601627749?check_suite_focus=true#step:5:4):2[5](https://github.com/aminya/setup-cpp/runs/6601627749?check_suite_focus=true#step:5:5))
      at internal/main/eval_stdin.js:29:5
      at Socket.<anonymous> (internal/process/execution.js:207:5)
      at Socket.emit (events.js:32[6](https://github.com/aminya/setup-cpp/runs/6601627749?check_suite_focus=true#step:5:7):22)
      at endReadableNT (_stream_readable.js:[12](https://github.com/aminya/setup-cpp/runs/6601627749?check_suite_focus=true#step:5:13)41:12)
Error: Something went wrong, self-installer exits with code 1
Installation Completed!
yonycalsin commented 2 years ago

I'm getting the same error.

I guess that in the logs it tries to parse the html syntax, and why would pnpm have to do that ?

image

aminya commented 2 years ago

It seems it fetches pnpm from 'https://pnpm.js.org/pnpm.js' and tries to parse the result.

https://github.com/pnpm/action-setup/blob/3c2fe8c59284aae169107529dce6c78999f48956/src/install-pnpm/run.ts#L22-L23

The JS file is not minified; its size is 4.3 MB! No surprise if it fails due to network issues.

image

ankurk91 commented 2 years ago

Same here https://github.com/ankurk91/google-chat-electron/runs/6605847171?check_suite_focus=true

      - name: Setup pnpm
        uses: pnpm/action-setup@v2.2.1
        with:
          version: 7.x.x

Looks like https://pnpm.js.org/pnpm.js is returning HTML instead of JS?

I ended up using this flow now

      - name: Setup node.js
        uses: actions/setup-node@v2
        with:
          node-version: 16.x

      - name: Install pnpm
        run: npm install -g pnpm@^7
Conduitry commented 2 years ago

https://pnpm.js.org/ is protected by Cloudflare, so my best (and only) guess is that the IPs GitHub is using for its macOS runners got ratelimited, and so what we're getting is Cloudflare's blocked page or its CAPTCHA page.

zkochan commented 2 years ago

We don't fetch from pnpm.js.org

https://github.com/pnpm/action-setup/blob/57b9359b4c69c79ca51422d02ca739a7957f4aed/src/install-pnpm/run.ts#L25

Conduitry commented 2 years ago

Well, all right, but it looks like https://get.pnpm.io/ is behind Cloudflare too, so I'm still betting it's the same thing.

zkochan commented 2 years ago

I am not sure. I have enabled caching for get.pnpm.io, so I don't think it would rate limit anything.

dominikg commented 2 years ago

one workaround is to use setup-node twice, and npm i -g pnpm. You can even parse packageManager field with jq example: https://github.com/sveltejs/vite-plugin-svelte/blob/main/.github/workflows/ci.yml#L27-L35

The solution for fixing this action is including pnpms install.sh in this repo and not relying on downloads from pnpm.io as discussed here https://github.com/pnpm/action-setup/issues/22

zkochan commented 2 years ago

:ship: 2.2.2

aminya commented 2 years ago

Now, it fails on Ubuntu 18.04 https://github.com/aminya/setup-cpp/runs/7125419782?check_suite_focus=true#step:5:9

Run pnpm/action-setup@v2
Running self-installer...
  [stdin]:1
  <!DOCTYPE html>
  ^

  SyntaxError: Unexpected token '<'
      at new Script (vm.js:88:7)
    at createScript (vm.js:2[6](https://github.com/aminya/setup-cpp/runs/7125419782?check_suite_focus=true#step:5:7)1:10)
    at Object.runInThisContext (vm.js:309:10)
    at Object.<anonymous> ([stdin]-wrapper:10:26)
Error: Something went wrong, self-installer exits with code 1
Installation Completed!
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at evalScript (internal/process/execution.js:94:25)
    at internal/main/eval_stdin.js:29:5
    at Socket.<anonymous> (internal/process/execution.js:20[7](https://github.com/aminya/setup-cpp/runs/7125419782?check_suite_focus=true#step:5:8):5)
    at Socket.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:[12](https://github.com/aminya/setup-cpp/runs/7125419782?check_suite_focus=true#step:5:13)41:12)