npm ERR! code EACCES code example

Example 1: npm ERR! code EACCES

sudo chown -R $USER ~/.npm
sudo chown -R $USER /usr/local/lib/node_modules
npm config set unsafe-perm=true

// or read this article if this not work 

https://docs.forestadmin.com/documentation/how-tos/setup/prevent-permission-errors-at-installation

Example 2: The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user

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

Example 3: The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user

cd /Users/Marc/Desktop/Dev
rm -rf ./masterclass/node_mdoules/
chown -R $USER ./masterclass/
cd masterclass    
npm install