Linux Node.js bash: /usr/local/bin/node: 权限被拒绝
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20573163/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Node.js bash: /usr/local/bin/node: Permission denied
提问by demi
I'm installing Node.js on Ubuntu machine. I followed official instructions:
我正在 Ubuntu 机器上安装 Node.js。我遵循了官方说明:
./configure && make && sudo make install
So, I got node binary in /usr/local/bin/node
and all dependencies. But when I run it from command line I get permission error:
所以,我得到了节点二进制文件/usr/local/bin/node
和所有依赖项。但是当我从命令行运行它时,出现权限错误:
> node
bash: /usr/local/bin/node: Permission denied
How can I fix it? How can I run it under my account? sudo node
doesn't work too.
我该如何解决?如何在我的帐户下运行它?sudo node
也不起作用。
采纳答案by hek2mgl
You need read- and executable permissions for others
. Issue:
您需要对others
. 问题:
sudo chmod +rx $(which node)
or
或者
sudo chmod 755 $(which node)
However, normally make install
should set that permissions. Looks like something in the Makefile
is wrong.
但是,通常make install
应该设置那个权限。里面的东西好像Makefile
有问题。
回答by sagits
For people with no knowledge of osx terminal, open it and use these commands:
对于不了解 osx 终端的人,打开它并使用以下命令:
su yourusername
su chmod 755 /usr/local/bin/node
sudo node install...
This will make the folder readable/writeable and the sudo before the node command will make it run under admin rights.
这将使文件夹可读/可写,并且节点命令之前的 sudo 将使其在管理员权限下运行。