【发布时间】:2020-01-24 13:50:53
【问题描述】:
操作系统 - macOS Catalina - 版本 10.15.2
我在 Mac 和我的 Windows 10 机器上使用了 bash shell,并在许多安装中使用了 apt-get。最近(可能在更新后)我注意到当我在 bash 中时,我无法再运行 apt-get。
[bash-3.2$ apt-get
bash: apt-get: command not found
这很奇怪,因为我在这台机器上多次使用 apt-get through bash。尝试熟悉 zsh shell,我已经成功安装了 homebrew。
% brew -v
Homebrew 2.2.4
Homebrew/homebrew-core (git revision 57b7f; last commit 2020-01-24)
看起来不错。现在是时候加载 Node(它总是在旁边安装 npm)
% brew install node
Warning: node 13.7.0 is already installed, it's just not linked
You can use 'brew link node' to link this version.
% brew link node
Linking /usr/local/Cellar/node/13.7.0...
Error: Could not symlink include/node/common.gypi
好的...
% brew link --overwrite node
Linking /usr/local/Cellar/node/13.7.0...
Error: Could not symlink include/node/common.gypi
/usr/local/include/node is not writable.
这就是我尝试从 zsh 运行节点时剩下的内容
% node -v
zsh: command not found: node
% npm -v
env: node: No such file or directory
如果我尝试在 sudo 中运行 brew,它会阻止 root 访问,理解。如果我尝试从节点的网站安装节点,我会收到此错误
“node-v12.14.1.pkg”无法打开,因为Apple无法检查它是否存在恶意软件。
有没有在 zsh 和 homebrew 方面有更多经验的人知道如何让我进入 zsh 中的节点?
我真的很喜欢使用像:npm create-react-app 这样的包。
来自 brew doctor 的更新
来自酿酒医生:
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
列出大约 150 个文件,然后
Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run 'brew link' on these:
node
Warning: Broken symlinks were found. Remove them with 'brew cleanup':
我运行了 brew cleanup 但出现错误
Error: Permission denied @ apply2files - /usr/local/lib/node_modules/npm/node_modules/.bin/JSONStream
【问题讨论】:
-
brew doctor说什么? -
来自 brew doctor:
Warning: Unbrewed header files were found in /usr/local/include. If you didn't put them there on purpose they could cause problems when building Homebrew formulae, and may need to be deleted.列出了大约 150 个文件,然后在这些文件上添加了Warning: You have unlinked kegs in your Cellar. Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to fail to run properly once built. Runbrew link`:node`Warning: Broken symlinks were found. Remove them withbrew cleanup:我运行了 brew cleanup -
鉴于MacOS没有有
apt-get,你之前是怎么安装的? (并且可能:为什么你之前安装过它?MacOS 不是 debian 风格,homebrew 是一般推荐的包管理器)你试过重新运行那个安装吗?至于安装 Node,这是您不想使用 brew 的情况之一,但 nvm 在管理您的节点安装方面做得更好。 -
当然,只是想知道您为什么需要它。另外,如果你错过了,你真的想要
nvm用于 Node,而不是brew install node。 -
嘿,这是 brew 实际上与有用相反的一个用例,尽管对于几乎所有其他事情来说它都非常方便。你如何运行你显示的 bash 找不到 apt-get 了?只是标准应用程序 -> 实用程序 -> 终端?