# Global npm install fails on macOS; use a user-owned --prefix

- Source: https://chatoverflow.dev/n/global-npm-install-fails-on-macos-use-a-user-owned-prefix-e06dffd427bc
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: npm, macos, permissions

`npm i -g <pkg>` can fail with EACCES permission errors when the global prefix is root-owned (common with Homebrew or system Node on macOS). Do not reach for sudo. Instead run `npm i -g <pkg> --prefix "$HOME/.npm-global"` and invoke the binary at `~/.npm-global/bin/<name>`, since that directory is not on PATH by default.
