使用自制软件安装 node.js 时遇到问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31374143/
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
Trouble install node.js with homebrew
提问by mlinegar
I'm trying to install Node.js with Homebrew (I installed it previously without using brew, and I've tried deleting all of those files). I've looked at previous questions asking similar things, but I haven't been able to get them to work. First I tried brew link nodewhich gave me:
我正在尝试使用 Homebrew 安装 Node.js(我之前没有使用 brew 安装过它,我已经尝试删除所有这些文件)。我看过以前提出类似问题的问题,但我无法让它们起作用。首先我试过brew link node这给了我:
myusername@c126h060:~$ brew link node
Linking /usr/local/Cellar/node/0.12.6...
Error: Could not symlink share/systemtap/tapset/node.stp
Target /usr/local/share/systemtap/tapset/node.stp
already exists. You may want to remove it:
rm '/usr/local/share/systemtap/tapset/node.stp'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
And then when I run brew link --overwrite nodeI get the following:
然后当我运行时,brew link --overwrite node我得到以下信息:
myusername@c126h060:~$ brew link --overwrite node
Linking /usr/local/Cellar/node/0.12.6...
Error: Could not symlink share/systemtap/tapset/node.stp
/usr/local/share/systemtap/tapset is not writable.
Additionally, when I tried using brew link -n nodeto find files to manually delete, I managed to delete some of them, but I'm still left with the following files that I can't delete:
此外,当我尝试使用brew link -n node查找要手动删除的文件时,我设法删除了其中的一些文件,但仍然留下以下无法删除的文件:
myusername@c126h060:~$ brew link -n node
Would link:
/usr/local/etc/bash_completion.d/npm
/usr/local/bin/node
/usr/local/include/node
/usr/local/share/man/man1/node.1
/usr/local/share/systemtap/tapset/node.stp
/usr/local/lib/dtrace/node.d
When I try to delete I get the following (same thing for all of these files):
当我尝试删除时,我得到以下信息(所有这些文件都是一样的):
myusername@c126h060:~$ rm /usr/local/etc/bash_completion.d/npm
rm: /usr/local/etc/bash_completion.d/npm: No such file or directory
What should I do?
我该怎么办?
回答by verbranden
It may be that you don't actually own your systemtap directory. Navigate to /usr/local/shareand run this command in order to make yourself the owner:
可能您实际上并不拥有 systemtap 目录。导航到/usr/local/share并运行此命令以使您自己成为所有者:
chown -R <yourusername>:<yourgroupname> systemtap
When I was fixing this same issue earlier today, I had to also go into /usr/localand do the same thing for the lib directory.
当我今天早些时候解决同样的问题时,我还必须进入/usr/locallib 目录并做同样的事情。
回答by cluther
Or, alternatively, verify the ownership and permissions on systemtap
或者,在 systemtap 上验证所有权和权限
$ ls -al /usr/local/share/systemtap/
drwxr-xr-x 3 root wheel 102 Oct 23 18:06 .
drwxrwxr-x 15 root wheel 510 Oct 24 20:24 ..
drwxr-xr-x 2 root wheel 68 Oct 24 20:17 tapset
then add yourself to the owner group (in this case wheel)
然后将自己添加到所有者组(在本例中为轮子)
sudo dscl . append /Groups/wheel GroupMembership <username>
then change the permissions on tapset to allow group edits
然后更改 Tapset 的权限以允许组编辑
sudo chmod -R 775 /usr/local/share/systemtap/tapset/
回答by Asim K T
What worked for me:
什么对我有用:
cd /usr/local/sharesudo chown -R <user>:<group> systemtap(Did 1 & 2 for/usr/localtoo)
cd /usr/local/sharesudo chown -R <user>:<group> systemtap(也做了 1 和 2/usr/local)
Above steps were failing. Went to next answer. Tried;
以上步骤失败。去下一个答案。尝试过;
ls -al /usr/local/share/systemtap/which throwed a 'Not found error.'
ls -al /usr/local/share/systemtap/这引发了“未找到错误”。
Then: brew link nodewas throwing an error. So I did:
然后:brew link node抛出错误。所以我做了:
sudo rm -rf /usr/local/lib/node_modulesbrew postinstall node -v- And at last
brew link node node -v:)
sudo rm -rf /usr/local/lib/node_modulesbrew postinstall node -v- 最后
brew link node node -v:)
So basically I removed all node_modules/folders and redid everything.
所以基本上我删除了所有node_modules/文件夹并重做所有内容。
回答by coderChrisLee
get your username,
获取您的用户名,
and get your groups:(could be more than one,generally is 'admin')
并获取您的群组:(可能不止一个,通常是“管理员”)
whoami
groups
then, for exapmle:
然后,例如:
sudo chown -R chrislee:admin /usr/local/share/systemtap/
回答by arunkumar sambu
arun:~$ brew link node
Linking /usr/local/Cellar/node/0.12.6...
Error: Could not symlink share/systemtap/tapset/node.stp
Target /usr/local/share/systemtap/tapset/node.stp
already exists. You may want to remove it:
rm '/usr/local/share/systemtap/tapset/node.stp'
Run below commands
运行以下命令
brew postinstall node -v
brew link node
回答by Shamsher
The following recipe worked for me:
以下食谱对我有用:
- Add your username to add group wheel
sudo dscl . append /Groups/wheel GroupMembership username sudo chmod -R 775 /usr/local/share/systemtap/tapset/sudo rm -rf /usr/local/lib/node_modulesbrew cleanupbrew link nodebrew uninstall --force nodebrew install node
- 添加您的用户名以添加组轮
sudo dscl . append /Groups/wheel GroupMembership username sudo chmod -R 775 /usr/local/share/systemtap/tapset/sudo rm -rf /usr/local/lib/node_modulesbrew cleanupbrew link nodebrew uninstall --force nodebrew install node
Then check version with node -vand npm -v.
然后使用node -v和检查版本npm -v。
回答by Raghib Arshi
just add sudo in the beginning of the command npm install expo-cli --global
只需在命令 npm install expo-cli --global 的开头添加 sudo
like sudo npm install expo-cli --globaland hit enter.
喜欢sudo npm install expo-cli --global并按回车键。
hope it'll help you.
希望它会帮助你。

