pub 全局激活命令 - $HOME/.pub-cache/bin 不在路径上 [英] pub global activate command - $HOME/.pub-cache/bin not on path

查看:29
本文介绍了pub 全局激活命令 - $HOME/.pub-cache/bin 不在路径上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近尝试安装 dart2,但是当我尝试安装 pub global activate stagehand 时,它带有警告.

I was trying to install dart2 recently, but when I try to install pub global activate stagehand, it comes with a warning.

警告:Pub 会将可执行文件安装到 $HOME/.pub-cache/bin 中,但它不在您的路径中.

Warning: Pub installs executables into $HOME/.pub-cache/bin, which is not on your path.

您可以通过将其添加到 shell 的配置文件(.bashrc.bash_profile 等)中来解决此问题:

You can fix that by adding this to your shell's config file (.bashrc, .bash_profile, etc.):

export PATH="$PATH":"$HOME/.pub-cache/bin"

所以我去了我的 .bash_profile 文件并添加了上面的内容,文件看起来像这样:

so i went to my .bash_profile file and added the above, and the file looks like this:

export PATH=/users/kevinau/dart/flutter/bin:$PATH
export PATH="$PATH":"$HOME/.pub-cache/bin"

但后来我运行 webdev 并且仍然没有找到命令.

but then I run webdev and the command is still not found.

谁能告诉我如何解决这个问题?

can anyone walk me thru how to fix this?

我试过 echo $PATH 并返回以下内容:

I tried echo $PATH and return the below:

/users/myspace/dart/flutter/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/sbin/.pub-cache/bin

但是我该如何解决呢?

推荐答案

在终端上使用 vim 编辑 zshrc 文件

Edit zshrc file using vim on terminal

vim ~/.zshrc

vim ~/.bashrc

按i"后在 zshrc 上编辑数据;键盘上.导出flutter位置、渡槽位置和dart sdk位置

edit data on zshrc after pressing "i" on keyboard. Export flutter location, aqueduct location and dart sdk location

export PATH="$PATH":"$HOME/Development/flutter/bin"
export PATH="$PATH":"$HOME/Development/flutter/.pub-cache/bin"
export PATH="$PATH":"$HOME/Development/flutter/bin/cache/dart-sdk/bin"

编辑后按esc"键 ~:wq 保存使用

After editing press "esc" key ~:wq for saving Check working of aqueduct using

aqueduct --version

aqueduct serve

这篇关于pub 全局激活命令 - $HOME/.pub-cache/bin 不在路径上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆