I am having issues trying to install nestJS for my MacBook and this error keeps popping up in my terminal when I use $ npm install -g @nestjs/cli . Am I doing something wrong or am I not putting this command line in the right place? Please help :)
Asked
Active
Viewed 2,001 times
0
-
try to run terminal in administrator mode and try it again – Zubair Saif Aug 26 '21 at 17:17
-
Please put your codes instead of including a screenshot of them – Mahyar Mottaghi Zadeh Aug 26 '21 at 17:18
-
1@ZubairSaif it worked! Thank you! I just used the installation command line from nestJS and put sudo in front of it and it worked. – Aug 26 '21 at 17:29
-
Please provide enough code so others can better understand or reproduce the problem. – Community Aug 26 '21 at 17:57
1 Answers
4
Running the command as sudo
is only a temporary solution as you generally want to have access to this directory as a regular user and you will undoubtedly run into future issues working with node_modules.
The right approach is to change the ownership on this directory so you don't need to use elevated permissions to interact with it.
sudo chown -R $USER /usr/local/lib/node_modules

Jesse Carter
- 20,062
- 7
- 64
- 101