npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules reactjs reactjs

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules


add following lines to ~/.bashrc after installing npm:

npm set prefix ~/.npmPATH="$HOME/.npm/bin:$PATH"PATH="./node_modules/.bin:$PATH"

Execute following line after changes:

source ~/.bashrc

and as mentioned by @contemplator avoid using sudo


Note: It is highly recommended to avoid using sudo with npm!

Using sudo is not recommended. It may give you permission issue later. While the above works, use these instructions to fix your issue permanently.


This command will change the owner (chown) recursively (-R) for the current user in the specified directory

sudo chown -R $USER /usr/local/lib/node_modules