Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing output when the root isn't an npm project, leaves a mess. #286

Open
srl295 opened this issue Aug 28, 2024 · 1 comment
Open

Confusing output when the root isn't an npm project, leaves a mess. #286

srl295 opened this issue Aug 28, 2024 · 1 comment
Labels
enhancement New feature or request triaged

Comments

@srl295
Copy link

srl295 commented Aug 28, 2024

Hi. I'm using this action to upload a project that's not at root an npm project. The output is kind of confusing, and leaves a mess of the workspace.

  /usr/local/bin/npx --no-install wrangler --version
  npm error npx canceled due to missing packages and no YES option: ["[email protected]"]
  npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2024-08-28T17_12_25_179Z-debug-0.log
  ⚠️ Wrangler not found or version is incompatible. Installing...
📥 Installing Wrangler
  /usr/local/bin/npm i [email protected]

okay. Why did you do npm i instead of just npx [email protected] ? Doesn't make sense.

Then when it goes to run:

  /usr/local/bin/npx wrangler pages deploy ./_site --project-name=cldr
  ▲ [WARNING] Warning: Your working directory is a git repo and has uncommitted changes
    To silence this warning, pass in --commit-dirty=true

Well, yeah, you dirtied it, wrangler :)

Run git status
HEAD detached at pull/3989/merge
Untracked files:
  (use "git add <file>..." to include in what will be committed)
	node_modules/
	package-lock.json
	package.json

So wrangler-action has added a node_modules, package.json and package-lock.json in my work area. And then complains that my work area is a mess.

I'm going to try a preemptive npm i -g [email protected] to see if it cleans things up.

srl295 added a commit to unicode-org/cldr that referenced this issue Aug 28, 2024
- pre-emptively install wrangler
- see cloudflare/wrangler-action#286 - otherwise wrangler leaves the repo a mess.
@shahsimpson shahsimpson added the enhancement New feature or request label Nov 12, 2024
@jahands
Copy link
Contributor

jahands commented Nov 18, 2024

I agree, this is odd behavior. I'm also now realizing that if we stop running npm i wrangler, we may break users who did not add a step to their GHA workflow to separately install dependencies.

There's two things we should do here:

  1. Only use npx instead of installing wrangler, causing the mess described here.
  2. In v4, do a possibly breaking change where we always use npx (or equivalent) rather than installing wrangler in the local project (or alternatively install globally, but the former probably makes more sense.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triaged
Projects
None yet
Development

No branches or pull requests

3 participants