This usually means npm is trying to write to a directory it doesn't own. On Linux/macOS, avoid running npm with sudo — instead, fix the permissions on your global node_modules folder: run `npm config get prefix` to find the path, then `sudo chown -R $(whoami) <path>`. On Windows, run your terminal as Administrator.
After a global install, the CLI tool is nowhere to be found. The problem is almost always a missing PATH entry. Run `npm bin -g` to get the global bin directory, then add it to your shell config (~/.bashrc, ~/.zshrc, etc.). Restart the terminal after saving.
You're either not logged in or the package name is already taken. Run `npm whoami` — if it returns an error, do `npm login` first. If you're authenticated but still getting 403, the package name might be claimed by another user. Scoped packages (`@yourname/package`) solve the naming conflict problem instantly.
Package-lock.json conflicts are painful to resolve manually. The safest fix: after resolving package.json conflicts, delete package-lock.json and run `npm install` fresh. This regenerates the lockfile cleanly without leftover merge markers.
Starting from npm v7, peer dependencies are installed automatically, which can cause conflicts. If you're getting ERESOLVE errors, run `npm install --legacy-peer-deps` as a short-term fix. Long-term, check which package versions are actually compatible and pin them explicitly in package.json.