Javascript required
Skip to content Skip to sidebar Skip to footer

Npm Powershell Please Try Running This Command Again as Root/administrator.

Typically when installing a new npm packages globally in your system, you will run into an error something like Error: EACCESS permission denied something.

Don't worry, information technology'southward natural I'g here to assist you lot to fix this kind of mistake.

To the Rescue

Normally I'm using node version manager (nvm) to handle my node versions, so I can easily switch to whatsoever version I adopt only we volition not talk over information technology here. I'll create a separate web log post for that on how to set a multiple node version using NVM (node version manager).

So allow's take a look the error that most probably something like this below:

Fault:

                                                npm                                      ERR                  !                                      Fault: EACCES,                                    open                                                      '/Users/letscodepare/.npm/-/all/.cache.json'                                                                                                        npm                                      ERR                  !                                                      {                                                      [                  Error: EACCES,                                    open up                                                      '/Users/letscodepare/.npm/-/all/.cache.json'                  ]                                                                                                        npm                                      ERR                  !                                      errno:                                    3                  ,                                                                                      npm                                      ERR                  !                                      code:                                    'EACCES'                  ,                                                                                      npm                                      ERR                  !                                      path:                                    '/Users/letscodepare/.npm/-/all/.enshroud.json'                                                      }                                                                                                        npm                                      ERR                  !                                      Please try running this                                    command                                      again as root/Administrator.                                                                                      ..                  ..                  .                                                                                      ..                  ..                  .                                          

Solution:

  1. Open up upwardly your favorite terminal and run this code
                                                sudo chown -R $(whoami) ~/.npm                                          

Then what does it do? To the Rescue

chown is a unix control which means "modify owner". From that definition based on our code above we are going to change the possessor of our binder ~/.npm which for sure the "root" user is applied.

We're going to assign this folder recursively to our own username using this command whoami so that it will exist piece of cake to read and write anything nosotros desire.

Notation: Somehow, even when we change the possessor of ~/.npm folder, we still encounter an EACCES error. To Fix that, nosotros should change the possessor of our node_modules binder.

                                                sudo chown -R $(whoami) /usr/local/lib/node_modules/                                          

Voila

Now you tin finally install npm packages without sudo.

Wait just wait

Adjacent Featured

Explore our new Tips and Tricks tutorial. Explore our Tips and Tricks

Voila!!!

I hope you enjoy our tutorial, Allow me know incase you lot come across any error I would love to answer that. Don't forget to subscribe to my Youtube Channel at Let's Lawmaking Pare - Youtube Channel

Buy Me A Coffee

Share Now

rimmeralte1945.blogspot.com

Source: https://letscodepare.com/blog/npm-resolving-eacces-permissions-denied