Skip to content

fix(setup): use local npm install for devcontainer CLI#112

Merged
c-vigo merged 6 commits intodevfrom
bugfix/111-fix-devcontainer-npm-permissions
Feb 20, 2026
Merged

fix(setup): use local npm install for devcontainer CLI#112
c-vigo merged 6 commits intodevfrom
bugfix/111-fix-devcontainer-npm-permissions

Conversation

@c-vigo
Copy link
Copy Markdown
Contributor

@c-vigo c-vigo commented Feb 20, 2026

Description

Fix just init failing to install the devcontainer CLI on Linux due to npm global install permission error (EACCES: permission denied on /usr/local/lib/node_modules). The @devcontainers/cli package is already declared in package.json, so this switches from npm install -g to a local npm install, matching the existing bats dependency pattern.

Related Issue(s)

Closes #111

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • CI / Build change
  • Test updates

Changes Made

  • scripts/requirements.yaml: Changed devcontainer entry to use local npm install instead of npm install -g, added node_modules/.bin/devcontainer fallback to check command, switched version command to npx devcontainer --version
  • tests/bats/init.bats: Added 2 tests asserting the local install pattern and absence of global install
  • CHANGELOG.md: Added Fixed entry under Unreleased

Changelog Entry

Fixed

  • just init fails to install devcontainer CLI on Linux (#111)
    • npm install -g requires root access to /usr/local/lib/node_modules, causing EACCES permission denied
    • Switched to local npm install (package already declared in package.json), matching the existing bats pattern

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

  1. npx bats tests/bats/init.bats --filter "devcontainer" — both new tests pass
  2. npx bats tests/bats/init.bats — all 70 tests pass (no regressions)
  3. just init --check — devcontainer 0.81.1 detected as installed via node_modules/.bin/devcontainer

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

The CI setup action (.github/actions/setup-env/action.yml) still uses npm install -g for the devcontainer CLI. This is intentional — GitHub Actions runners have appropriate permissions for global installs. Only the local development path (just init) is affected by this fix.

Refs: #111

Assert that requirements.yaml uses node_modules/.bin/devcontainer
fallback check and does not use npm install -g. Both tests fail
against the current code (TDD RED phase).

Refs: #111
Switch devcontainer entry in requirements.yaml from global
npm install (-g) to local npm install, matching the bats pattern.
The package is already declared in package.json so a local install
suffices and avoids EACCES permission errors on Linux.

Refs: #111
@c-vigo c-vigo self-assigned this Feb 20, 2026
Assert that conftest.py checks node_modules/.bin/devcontainer and
does not reference npm install -g in skip messages. Both tests fail
against current code (TDD RED phase).

Refs: #111
Update two pytest fixtures in conftest.py to also check
node_modules/.bin/devcontainer when the CLI is not on PATH,
preventing integration tests from skipping after the switch
to local npm install.

Refs: #111
- Extract _find_devcontainer_cli() to deduplicate CLI detection
- Prepend node_modules/.bin to PATH in devcontainer_up fixture
- Use resolved binary path in _run_devcontainer_up

Refs: #111
@c-vigo c-vigo merged commit 10f39d7 into dev Feb 20, 2026
11 checks passed
@c-vigo c-vigo deleted the bugfix/111-fix-devcontainer-npm-permissions branch February 20, 2026 13:19
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.

1 participant