GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(plugin): load npm config before Arborist installs by ghost91- · Pull Request #22025 · anomalyco/opencode

Conversation

@ghost91-

@ghost91- ghost91- commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #21123

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This fixes plugin installs from private npm registries.

After the switch to @npmcli/arborist, OpenCode created Arborist without loading npm config first. That caused plugin installs to ignore .npmrc settings such as scoped registries and fall back to registry.npmjs.org.

This PR loads npm config with @npmcli/config and passes the flattened result into Arborist. Npm.add() loads config from Global.Path.cache, which preserves the previous cache-local .npmrc behaviour. Npm.install(dir) loads config from dir, so local config still works there as well.

Related:

  • [Bug] .opencode/package-lock.json generated without respecting ~/.npmrc registry configuration #21079
  • Npm.outdated() and @npmcli/arborist in src/npm/index.ts ignore user's npm registry config — plugin install hanging in some area #21324
  • Plugin install fails to use custom npm registry #21436

How did you verify your code works?

  1. Added regression tests for:
    • scoped registry config from user .npmrc
    • cache-root .npmrc
    • install-dir .npmrc
  2. Ran:
    • bun test test/npm/index.test.ts
    • bun test test/config/config.test.ts
    • bun test test/plugin/loader-shared.test.ts
    • bun typecheck
  3. Built the patched binary locally and verified that installing a plugin from a private scoped registry now works with .npmrc config.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot added the contributor label Apr 11, 2026
@github-actions

github-actions Bot commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found a potentially related PR:

PR #21697: fix(opencode): resolve npmrc with @npmcli/config
#21697

This PR appears related because it also deals with resolving npm config using @npmcli/config. Since PR #22025 (current) is specifically about loading npm config before Arborist installs for the plugin system, while #21697 may address a similar issue in the main opencode codebase, they could be addressing related or overlapping concerns with npm configuration handling.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost91- ghost91- mentioned this pull request Apr 11, 2026
fix(opencode): resolve npmrc with @npmcli/config #21697
Closed
ghost91-
ghost91- commented Apr 11, 2026
View reviewed changes
Comment thread packages/opencode/package.json Resolved

Uh oh!

There was an error while loading. Please reload this page.

@cynicalight

cynicalight commented Apr 11, 2026

Copy link
Copy Markdown

hello, do you know why everybody failed these two test: e2e(linux) and e2e(windows)? 🤣

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@YumaKakuya YumaKakuya mentioned this pull request Apr 11, 2026
e2e (linux) and e2e (windows) jobs flaky/broken on dev — ~98% fail today #22051
Closed
@ghost91-
ghost91- force-pushed the fix/plugin-npmrc-registry branch 4 times, most recently from 66f6b63 to 76589e2 Compare April 14, 2026 10:28
@ghost91- ghost91- mentioned this pull request Apr 14, 2026
Plugin install ignores scoped registries from ~/.npmrc and fetches from registry.npmjs.org #21123
Closed
@cp0213

cp0213 commented Apr 15, 2026

Copy link
Copy Markdown

Can't wait for this PR to be merged! My opencode has been stuck at version 1.3.13 and I haven't been able to update it for days.

sinnwise, aaronysj, sagitzur, njimenezotto, junmediatek, cynicalight, Hutsh, HiChen404, fabiohora, zchazc, and 2 more reacted with thumbs up emoji bytesnail reacted with rocket emoji bytesnail reacted with eyes emoji
All reactions
  • 👍 12 reactions
  • 🚀 1 reaction
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ghost91- added 2 commits April 15, 2026 10:04
@ghost91-
refactor(npm): remove unused outdated function
fd4c343
@ghost91-
fix(plugin): load npm config for Arborist installs
95bd891
@ghost91-
ghost91- force-pushed the fix/plugin-npmrc-registry branch from 76589e2 to 95bd891 Compare April 15, 2026 08:36
j4ng5y added a commit to j4ng5y/opencode that referenced this pull request Apr 16, 2026
@j4ng5y
fix: respect npm config cwd for plugin installs
7f7228e
Load npm config from the active instance/config directory when installing plugin and provider packages so project .npmrc settings and env precedence are preserved for cached installs.

Refs anomalyco#21123, anomalyco#21324, anomalyco#21436, anomalyco#21697, anomalyco#22025.
@github-actions github-actions Bot mentioned this pull request Apr 16, 2026
fix: respect npm config cwd for plugin installs #22765
Closed
4 of 6 tasks
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 2f2ed11 to 9f201d6 Compare April 16, 2026 21:55
@ghost91-

ghost91- commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

Obsolete by now, fixed by #24001

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost91- ghost91- closed this Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Plugin install ignores scoped registries from ~/.npmrc and fetches from registry.npmjs.org

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@ghost91- @cynicalight @cp0213
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.