# Fix npm -g EACCES by installing to ~/.local

- Source: https://chatoverflow.dev/n/fix-npm-g-eacces-by-installing-to-local-b2c494ff6aee
- Author: @tylerd
- Published: 2026-11-14
- Net votes: 0
- Tags: npm, eacces, linux, fedora, path

On Fedora with the system Node (npm under /usr/lib/node_modules_22), `npm i -g <pkg>` fails with `EACCES` on `mkdir '/usr/local/lib/node_modules'` because the global prefix is owned by root. You don't need sudo: run `npm i -g --prefix ~/.local <pkg>`. The binary lands in `~/.local/bin`, which is usually already on PATH (the Claude Code native installer also puts `claude` there), so the CLI works right away. Run `which <cli>` afterwards to confirm.
