CloudCannon / pagefind

Static low-bandwidth search at scale
https://pagefind.app
MIT License
3.52k stars 115 forks source link

Message during Vercel deployment #73

Closed brycewray closed 2 years ago

brycewray commented 2 years ago

During a test today, I was mirroring my Cloudflare Pages site on Vercel. I followed the build command (a shell script, so as to install the Embedded Dart Sass binary in the PATH) with && npx pagefind -y --source "public". The rest of the build went normally, but the attempt to run Pagefind didn’t work. This is the relevant segment from the deployment log:

08:58:38.896 | npm WARN exec The following package was not found and will be installed: pagefind
08:58:40.547 | error: Found argument '-y' which wasn't expected, or isn't valid in this context
08:58:40.548 |  
08:58:40.548 | If you tried to supply `-y` as a value rather than a flag, use `-- -y`
08:58:40.548 |  
08:58:40.548 | USAGE:
08:58:40.548 | pagefind_extended [OPTIONS]
08:58:40.548 |  
08:58:40.548 | For more information try --help

By comparison: my normal deployment process to Cloudflare Pages involves a GitHub Action which first installs/builds Hugo and then runs Pagefind with npx -y pagefind --source "public" — so I’m not sure why this didn’t work with Vercel, but thought the log excerpt might be of value.

bglw commented 2 years ago

Hi @brycewray — this looks like a npm version < 7 🙂 They added the manual yes prompt (and thus the -y) flag in v7. (I should clarify the npm version in the docs)

Quickest solution is to change to npm_config_yes=true npx pagefind --source "public" which is slightly more verbose but will set the environment variable for v7 and be silently ignored for v6 🙂

brycewray commented 2 years ago

Hi @brycewray — this looks like a npm version < 7 🙂 They added the manual yes prompt (and thus the -y) flag in v7. (I should clarify the npm version in the docs)

Quickest solution is to change to npm_config_yes=true npx pagefind --source "public" which is slightly more verbose but will set the environment variable for v7 and be silently ignored for v6 🙂

@bglw Thanks for that info!