Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'whoami' does not work on mac terminal

When I set up Node js environment, I often encounter npm permission error, as it can't access /node-modules/. With the help of this question (npm throws error without sudo), I managed to change the ownership. However, I had to type my username, instead of 'whoami' as in the example.

sudo chown -R 'whoami' ~/.npm
chown: whoami: illegal user name

Does it mean 'whoami' is not supported on mac, or am I doing something wrong?

like image 277
Andrew Chaa Avatar asked Nov 11 '13 18:11

Andrew Chaa


1 Answers

You have a typo: you need to use backward ticks

sudo chown -R `whoami` ~/.npm
like image 114
Christian Fritz Avatar answered Oct 07 '22 23:10

Christian Fritz