如何在 ubuntu 中永久修复 Homebrew 路径问题

How to Fix Howbrew path issue permanently in ubuntu

我正在使用 linuxbrew 安装节点。这很好用,除非,因为我只能在执行以下路径导出后才能使用节点。

export PATH="/home/ericel/.linuxbrew/bin:$PATH"

如果我关闭那个终端并打开一个新终端,我仍然必须执行相同的 PATh 导出才能使我的节点正常工作。

有没有办法永久解决这个问题? 我做 brew doctor,我得到以下说明:

ericel@ericel-X401A:~$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: /usr/bin occurs before /home/ericel/.linuxbrew/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:
  xzmore
  unlzma
  lzcmp
  brew
  xzegrep
  lzgrep
  lzdiff
  lzless
  lzma
  pkg-config
  xzfgrep
  xzdiff
  xz
  lzfgrep
  lzcat
  lzegrep
  unxz
  xzgrep
  xzcat
  xzless
  lzmore
  lzmainfo
  xzcmp

Consider setting your PATH so that /home/ericel/.linuxbrew/bin
occurs before /usr/bin. Here is a one-liner:
  echo 'export PATH="/home/ericel/.linuxbrew/bin:$PATH"' >> ~/.bash_profile

Warning: Homebrew's bin was not found in your PATH.
Consider setting the PATH for example like so
  echo 'export PATH="/home/ericel/.linuxbrew/bin:$PATH"' >> ~/.bash_profile

Warning: You have a non-Homebrew 'pkg-config' in your PATH:
  /usr/bin/pkg-config

`./configure` may have problems finding brew-installed packages using
this other pkg-config.

Warning: Homebrew's share was not found in your XDG_DATA_DIRS but you have
this variable set to include other locations.
Some programs like `vapigen` may not work correctly.
Consider setting the XDG_DATA_DIRS for example like so
    echo 'export XDG_DATA_DIRS="/home/ericel/.linuxbrew/share:$XDG_DATA_DIRS"' >> ~/.bash_profile

但即使这样做了,node 也只能为那个终端工作。我正在使用 ubuntu 16.**

刚遇到同样的错误。我想是的,因为我首先从官方页面说明安装了 linuxbrew,然后我使用了 apt-get.

所以我删除了 apt-get 安装

sudo apt remove linuxbrew-wrapper

然后将路径添加到

nano ~/.bashrc

官方文档中写的

echo 'export PATH="$HOME/.linuxbrew/bin:$PATH"' >>~/.bash_profile

然后你需要打开新的终端才能生效。