我刚刚在我的mac上安装了stagehand并且安装顺利完成,但是当我尝试使用它来生成新的dart应用程序时,我收到此错误-bash: stagehand: command not found
。有什么想法吗?
答案 0 :(得分:10)
我看过我的机器,舞台就在〜/ .pub-cache / bin中,我认为我必须手动添加到我的.profile中:
export PATH=$PATH:~/.pub-cache/bin
(编辑:我刚刚在pub
页面中找到了确认信息:https://www.dartlang.org/tools/pub/cmd/pub-global#running-a-script-from-your-path)
答案 1 :(得分:2)
我也在Mac上。我是这样做的:
brew tap dart-lang/dart
brew install dart
stagehand
zsh: command not found: stagehand
然后此命令将其修复:
pub global activate stagehand
现在可以使用了
stagehand
Welcome to Stagehand!
答案 2 :(得分:1)
在MacOS上,运行以下命令:export PATH =“ $ PATH”:“ $ HOME / .pub-cache / bin”
答案 3 :(得分:1)
我在我的 Windows 电脑上遇到了同样的问题。我不得不检查 flutter 安装目录并将以下 .pub-cache\bin 目录添加到 Windows 路径环境变量中。
D:\flutter\.pub-cache\bin
我认为这可能对任何 Windows 用户都有帮助。
答案 4 :(得分:0)
我安装了它,但仍然给我错误未找到,但我在运行命令后注意到以下消息中的警告:
Package stagehand is currently active at version 3.3.11.
Resolving dependencies...
The package stagehand is already activated at newest available version.
To recompile executables, first run `global decativate stagehand`.
Installed executable stagehand.
Warning: Pub installs executables into C:\Users\Nijat\AppData\Local\Pub\Cache\bin, which is not on your path.
You can fix that by adding that directory to your system's "Path" environment variable.
A web search for "configure windows path" will show you how.
Activated stagehand 3.3.11.
问题是这一行:
Warning: Pub installs executables into C:\Users\Nijat\AppData\Local\Pub\Cache\bin, which is not on your path.
因此,您还需要将其添加到您的环境变量中。这解决了我的问题,现在我可以运行 stagehand。