fix(cli): fall back to a writable npm prefix when the global one is read-only - #1070
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(cli): fall back to a writable npm prefix when the global one is read-only#1070posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
…ead-only On a Nix-provisioned machine, Node lives in the read-only `/nix/store`, which is npm's global prefix, so `npm install --global @posthog/cli@latest` dies with `EACCES`. The source maps flow then finished looking successful while the release build could never upload debug symbols. `installOrUpdatePostHogCli` now retries against a user-writable prefix (`~/.posthog`) on a permission error and puts its `bin` directory on PATH so the later `posthog-cli` spawns resolve. The same guarded install backs `wizard cli add`. The source maps pre-install no longer reports a handled, environmental failure to error tracking with `captureException`; it keeps the user-facing warning and records a `wizardCapture` event instead. Generated-By: PostHog Code Task-Id: a077ce16-593d-4697-bc50-b7d6b30e24b1
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
/nix/store, which is npm's global prefix, sonpm install --global @posthog/cli@latestdies withEACCES.installOrUpdatePostHogClihad no fallback.wizard cli add.captureException— noise, not a bug.Changes
EACCES/EROFS/EPERM/ "permission denied"),installOrUpdatePostHogCliretries withnpm install --global --prefix ~/.posthogand prepends the fallbackbindirectory toPATH, so laterposthog-clispawns resolve. Both call sites — the source maps pre-install andwizard cli add— share this one guarded install.wizardCaptureevent, and no longer callscaptureException(mirrors #456 for external tool errors). The now-deaderrorObjectfield onCliInstallResultis removed.Test plan
pnpm build && pnpm test— 1740 tests pass.--prefixargs and the PATH entry), no retry on a non-permission failure, and surfacing the retry failure when the fallback prefix also fails.LLM context
Authored by a PostHog coding agent.
errorObjectwas removed because its only consumer was thecaptureExceptioncall this PR deletes.Created with PostHog Desktop from this inbox report.