Skip to content

fix(cli): strip trailing slash from registry URL in install script#916

Merged
fengmk2 merged 1 commit intovoidzero-dev:mainfrom
zerone0x:fix/install-double-slash-registry-url
Mar 16, 2026
Merged

fix(cli): strip trailing slash from registry URL in install script#916
fengmk2 merged 1 commit intovoidzero-dev:mainfrom
zerone0x:fix/install-double-slash-registry-url

Conversation

@zerone0x
Copy link
Contributor

Summary

Fixes the Windows install script failing with a 404 error when the user's npm registry URL has a trailing slash (e.g., https://registry.npmmirror.com/).

The trailing slash causes a double slash in the constructed URL (https://registry.npmmirror.com//pnpm/latest), which returns 404. The install shell scripts (install.ps1 and install.sh) already strip trailing slashes for their own URL construction, but the Rust binary (vp.exe) reads NPM_CONFIG_REGISTRY directly from the environment without stripping.

Fix: Strip trailing slashes from the registry URL in two places:

  • EnvConfig::from_env() — where the registry URL is read from environment variables (affects all commands)
  • resolve_version() — where a registry override parameter is used for upgrades

Fixes #904

When the npm registry URL has a trailing slash (e.g.,
`https://registry.npmmirror.com/`), URL concatenation produces a double
slash (`https://registry.npmmirror.com//pnpm/latest`) which returns 404.

Strip trailing slashes from the registry URL in EnvConfig::from_env()
and in the upgrade registry resolver to prevent this.

Fixes voidzero-dev#904

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@netlify
Copy link

netlify bot commented Mar 15, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 5df035b
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69b6c8d2ea3fc60009a183e7

@fengmk2 fengmk2 merged commit db67e9b into voidzero-dev:main Mar 16, 2026
21 checks passed
@fengmk2
Copy link
Member

fengmk2 commented Mar 16, 2026

@zerone0x Thanks!

@zerone0x zerone0x deleted the fix/install-double-slash-registry-url branch March 16, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] Install script fails due to double slash in registry URL causing 404 error

2 participants