Day075 — Avoid “Error: EACCES: permission denied”

Jacky Tsang
1 min readMay 11, 2019

--

When I want to install a package globally, Error: EACCES: permission denied occurs.

If you see an EACCES error when you try to install a package globally, you can either:

Reinstall npm with a node version manager (recommended),
or
Manually change npm’s default directory

https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

Therefore, I reinstall npm with a node version manager.

To uninstall installed nodejs:

  1. go to /usr/local/lib and delete any node and node_modules
  2. go to /usr/local/include and delete any node and node_modules directory

To install nodejs via nvm:

# install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
# verify installation
command -v nvm
# install the latest node
nvm install node

To install a specific version of node:

nvm install 6.14.4 # or 10.10.0, 8.9.1, etc

reference:

--

--

No responses yet