'whoami' does not work on mac terminal

末鹿安然 提交于 2019-12-23 09:26:23

问题


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?


回答1:


You have a typo: you need to use backward ticks

sudo chown -R `whoami` ~/.npm


来源:https://stackoverflow.com/questions/19913218/whoami-does-not-work-on-mac-terminal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!