I can't get a simple bash script to run due to PATH being mangled?

If support folks want to look: https://dash.cloudflare.com/c67910a047e1510fec6d0d0cf442934c/pages/view/ember-apply/59801594-0a6d-494c-a8e4-cc57a711a5b8

Here is my log (attached, I guess).

and my script:
#!/bin/bash
#
echo "For running on Cloudflare builders only"

set -a

npm install --location global pnpm
pnpm i --store=node_modules/.pnpm-store

pnpm_location=$(which pnpm)
export PATH="$PATH:$(dirname $pnpm_location)"

pnpm build:docs
cd packages/docs/
# cloudflare broke all user's Sites that have a "functions" path.
# ... thanks cloudflare. you're usually such a good company :p 
#
#  - https://github.com/NullVoxPopuli/ember-resources/issues/679
#    - https://github.com/TypeStrong/typedoc/issues/2111
#    - https://github.com/cloudflare/wrangler2/issues/2240
mv dist/functions dist/funcs  
find ./dist -type f -name '*.html' | xargs sed -i.bak --regexp-extended 's:(href="[^"]+)functions/:\1funcs/:g' 


The need for this script comes from two assumptions:
  • cloudlfare doesn't support pnpm / have it installed by default
  • cloudflare brake /functions/ paths
But now I get errors like:
08:36:12.838    sh: 1: typedoc: not found
08:36:12.842    undefined

because of some weird shell behavior.

Why is it running under sh when my script is bash?
Was this page helpful?