fix(setup): use local npm install for devcontainer CLI#112
Merged
Conversation
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
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
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.
Description
Fix
just initfailing to install thedevcontainerCLI on Linux due to npm global install permission error (EACCES: permission deniedon/usr/local/lib/node_modules). The@devcontainers/clipackage is already declared inpackage.json, so this switches fromnpm install -gto a localnpm install, matching the existingbatsdependency pattern.Related Issue(s)
Closes #111
Type of Change
Changes Made
scripts/requirements.yaml: Changed devcontainer entry to use localnpm installinstead ofnpm install -g, addednode_modules/.bin/devcontainerfallback to check command, switched version command tonpx devcontainer --versiontests/bats/init.bats: Added 2 tests asserting the local install pattern and absence of global installCHANGELOG.md: Added Fixed entry under UnreleasedChangelog Entry
Fixed
just initfails to install devcontainer CLI on Linux (#111)npm install -grequires root access to/usr/local/lib/node_modules, causing EACCES permission deniednpm install(package already declared inpackage.json), matching the existingbatspatternTesting
just test)Manual Testing Details
npx bats tests/bats/init.bats --filter "devcontainer"— both new tests passnpx bats tests/bats/init.bats— all 70 tests pass (no regressions)just init --check— devcontainer 0.81.1 detected as installed vianode_modules/.bin/devcontainerChecklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
The CI setup action (
.github/actions/setup-env/action.yml) still usesnpm install -gfor 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