You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WSL2 Ubuntu18下Yarn全局安装Adonis CLI后命令无法调用问题

Fix: adonis: command not found After Global Installation via Yarn in WSL2 Ubuntu 18

Got it, let's break down why this is happening and how to fix it quickly:

Why does this happen?

When you run commands through your package.json scripts with Yarn, Yarn automatically adds the directory where global binaries are stored to the session's PATH environment variable. But when you run adonis directly in your terminal, your system's PATH doesn't include that directory—so it can't locate the command.

Step-by-step fix

1. Find Yarn's global binary directory

First, run this command to get the exact path where Yarn stores global binaries:

yarn global bin

You'll get an output like /home/your-username/.yarn/bin (the exact path depends on your user setup).

2. Check if this path is in your system's PATH

Run this to view your current PATH entries:

echo $PATH

If the path from yarn global bin isn't listed here, that's the root cause of your issue.

3. Add the path to PATH (temporary fix)

To make adonis work immediately in your current terminal session, run:

export PATH="$PATH:$(yarn global bin)"

Now try running adonis—it should work! Note: This change will reset when you close your terminal.

4. Add the path to PATH permanently

To make this fix stick across all terminal sessions:

  • If you use Bash, open your ~/.bashrc file with a text editor (like nano):
    nano ~/.bashrc
    
  • If you use Zsh, open ~/.zshrc instead:
    nano ~/.zshrc
    
  • Add this line at the end of the file:
    export PATH="$PATH:$(yarn global bin)"
    
  • Save and exit (for nano: press Ctrl+O, hit Enter, then Ctrl+X).
  • Reload the configuration file to apply changes right away:
    # For Bash
    source ~/.bashrc
    
    # For Zsh
    source ~/.zshrc
    

Now every time you open a new terminal, you'll be able to run adonis directly from the command line.

内容的提问来源于stack exchange,提问作者Evandro Pomatti

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:47:00