cloudflare / wrangler-action

🧙‍♀️ easily deploy cloudflare workers applications using wrangler and github actions
Apache License 2.0
1.26k stars 159 forks source link

Can't install monorepo package deps `ERR_PNPM_PREPARE_PACKAGE` #284

Closed Hacksore closed 2 months ago

Hacksore commented 3 months ago

I have a monoerepo that when wrangler tries to install it will yield a ERR_PNPM_PREPARE_PACKAGE because in the root of the monorepo I have this github hosted dep:

"@types/github-script": "github:actions/github-script",

I can setup a simple repro if I can get some tiem but starting the issue first.

Run where this happened: https://github.com/overlayeddev/overlayed/actions/runs/10453108973/job/28942911152

error:

đź“Ą Installing Wrangler
  /home/runner/setup-pnpm/node_modules/.bin/pnpm add wrangler@3.13.2
  ../..                                    | Progress: resolved 1, reused 0, downloaded 0, added 0
  ../bot                                   |  WARN  deprecated wrangler@3.60.0
  ../..                                    | Progress: resolved 52, reused 0, downloaded 0, added 0
  Packages are hard linked from the content-addressable store to the virtual store.
    Content-addressable store is at: /home/runner/setup-pnpm/node_modules/.bin/store/v3
    Virtual store is at:             ../../node_modules/.pnpm
  ...1836_5358a22c8[17](https://github.com/overlayeddev/overlayed/actions/runs/10453108973/job/28942911152#step:5:19)95d483f28793842fa6ee5 npm-install$ npm install
  ../..                                    | Progress: resolved 91, reused 0, downloaded 0, added 0
  ...[18](https://github.com/overlayeddev/overlayed/actions/runs/10453108973/job/28942911152#step:5:20)36_5358a22c81795d483f28793842fa6ee5 npm-install: npm error code EBADENGINE
  ...1836_5358a22c81795d483f28793842fa6ee5 npm-install: npm error engine Unsupported engine
  ...1836_5358a22c81795d483f28793842fa6ee5 npm-install: npm error engine Not compatible with your version of node/npm: github-script@7.0.1
  ...1836_5358a22c81795d483f28793842fa6ee5 npm-install: npm error notsup Not compatible with your version of node/npm: github-script@7.0.1
  ...1836_5358a22c81795d483f28793842fa6ee5 npm-install: npm error notsup Required: {"node":">=20.0.0 <21.0.0"}
  ...1836_5358a22c81795d483f28793842fa6ee5 npm-install: npm error notsup Actual:   {"npm":"10.7.0","node":"v18.20.4"}
  ...1836_5358a22c81795d483f28793842fa6ee5 npm-install: npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2024-08-[19](https://github.com/overlayeddev/overlayed/actions/runs/10453108973/job/28942911152#step:5:21)T12_13_29_490Z-debug-0.log
  ...1836_5358a22c81795d483f28793842fa6ee5 npm-install: Failed
  /home/runner/work/overlayed/overlayed:
   ERR_PNPM_PREPARE_PACKAGE  Failed to prepare git-hosted package fetched from "https://codeload.github.com/actions/github-script/tar.gz/35b1cdd1b2c1fc704b1cd9758d10f67e833fcb02": github-script@7.0.1 npm-install: `npm install`
  Exit status 1

A simple thought would be can we pass args to the install command so that I could do something like:

pnpm i --filter=api
Hacksore commented 2 months ago

setup a repro for this here https://github.com/Hacksore/pnpm-bug-github-hosted-package

Hacksore commented 2 months ago

This still needs to be fixed but I tried using preCommands to uninstall the offending package but it didn't work.

I settled on a a janky workaround to remove it in a prior step so for now im good.

- name: Remove types package
  run: pnpm uninstall @types/github-script