feat: add npm cache ownership preflight check#462
Open
siwachabhi wants to merge 1 commit intoaws:mainfrom
Open
feat: add npm cache ownership preflight check#462siwachabhi wants to merge 1 commit intoaws:mainfrom
siwachabhi wants to merge 1 commit intoaws:mainfrom
Conversation
59ae10f to
70ef36e
Compare
70ef36e to
4373779
Compare
Detect root-owned files in ~/.npm before running npm install. A previous `sudo npm install` leaves root-owned cache files that cause EACCES permission errors on subsequent installs. The check runs in both the create and deploy preflight paths, and gives users the exact fix command (sudo chown -R $(whoami) ~/.npm). Skipped on Windows. Also fixes rollup high severity vulnerability (GHSA-mw96-cpmx-2vgc).
4373779 to
336cf3e
Compare
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.
Summary
~/.npmcache directories before runningnpm installsudo npm installleaves root-owned files in the cache, causing cryptic EACCES permission errors on subsequent installscheckCreateDependencies) and deploy (checkDependencyVersions) preflight pathssudo chown -R $(whoami) ~/.npmMotivation
Reported by a user running
agentcore createwho had previously runsudo npm installon their machine. The resulting EACCES error in npm output was difficult to diagnose. This check catches it early with a clear, actionable message.Changes
checks.ts: AddedcheckNpmCacheOwnership()andformatNpmCacheError(), wired into bothcheckDependencyVersions()andcheckCreateDependencies()index.ts: Exported new function and typeschecks-extended.test.ts: Added unit tests for the new check and error formatterTest plan
npm run buildpassesvitest run --project unit src/cli/external-requirements/__tests__/)~/.npmis root-owned