Fix npm EACCES error installing pi extension globally
Session from pi-sessions on Hugging Face by OmarRabhI · Apache-2.0 · condensed by Coders Talk
4msession
0interventions
GOAL
Fix a permission error when installing the tau-mirror npm package globally via pi, and get global npm installs working without needing sudo.
- +0Prompt · +0pi install npm:tau-mirror fails with EACCES permission error
- +0mAgent did · +0mInvestigated /usr/lib/node_modules/tau-mirror, found it already installed and owned by root, explained the permission conflict and offered options (skip, chown, or sudo)
- +3mPrompt · +3mCould node modules be installed locally inside my home directory instead?
- +3mAgent did · +3mChecked npm's global prefix (was /usr), created ~/.local/lib/node_modules and ~/.local/bin, set npm prefix to ~/.local, verified ~/.local/bin was already in PATH
- +3mAgent did · +3mReinstalled tau-mirror with npm install -g, package landed correctly under ~/.local/lib/node_modules but no binary was found on PATH
- +3mAgent did · +3mInspected package.json and determined tau-mirror is a pi extension with no CLI bin, so the missing binary was expected, not a bug
- +4mAgent did · +4mRe-ran pi install npm:tau-mirror which now succeeded cleanly, installing into the home-directory node_modules path
- +4mOutcome · +4mnpm global prefix switched to ~/.local, tau-mirror installed successfully without sudo, and future global installs will avoid permission errors
VERDICT
Next time I'd just ask upfront to move npm's global prefix to my home directory instead of troubleshooting the EACCES error first — that's what actually fixed things for good. Redirecting the npm prefix to ~/.local was the real fix; the earlier root-owned install was just a symptom.