'whoami'在Mac终端上不起作用 [英] 'whoami' does not work on mac terminal
本文介绍了'whoami'在Mac终端上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
设置Node js环境时,我经常遇到npm权限错误,因为它无法访问/node-modules/.在这个问题的帮助下( npm抛出没有sudo的错误),我设法进行了更改所有权.但是,我必须键入用户名,而不是示例中的"whoami".
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
这是否意味着Mac上不支持"whoami",或者我做错了什么?
Does it mean 'whoami' is not supported on mac, or am I doing something wrong?
推荐答案
您有错别字:您需要使用向后的滴答声
You have a typo: you need to use backward ticks
sudo chown -R `whoami` ~/.npm
这篇关于'whoami'在Mac终端上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文