2

Installed Adonis with yarn on Ubuntu 18 (running on WSL2 VM):

pomatti@NT-03024:~/Projects/myApp$ yarn global add @adonisjs/cli
yarn global v1.19.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "@adonisjs/cli@4.0.12" with binaries:
      - adonis
Done in 3.29s.

However when I try to run it, the command is not found:

pomatti@NT-03024:~/Projects/myApp$ adonis
adonis: command not found

What is odd is that my package.json commands are working properly and my app is started, but I am not able to call adonis directly in the command line (the global installation).

For example, yarn migration && adonis serve --dev --debug works.

"scripts": {
    "serve": "adonis serve",
    "migration": "adonis migration:run",
    "start": "yarn migration && yarn serve",
    "dev": "yarn migration && adonis serve --dev --debug",
    "lint": "yarn eslint"
  },
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Evandro Pomatti
  • 13,341
  • 16
  • 97
  • 165

2 Answers2

3

Try to install with NPM. Command:

> npm i -g @adonisjs/cli

Official documentation

crbast
  • 2,192
  • 1
  • 11
  • 21
0

For CLI tools installed with yarn global to work, you need to have the global yarn bin directory in your PATH. By default the yarn bin dir should be ~/.yarn/bin. To double check if that's right on your system and the adonis executable exists (assuming you've already run yarn global add @adonisjs/cli):

ls ~/.yarn/bin/adonis

(Mine is there).

To add that to my PATH:

cat > ~/.bashrc.d/yarn <<EOF
PATH="$HOME/.yarn/bin:\$PATH"
EOF
chmod +x ~/.bashrc.d/yarn
. ~/.bashrc.d/yarn

Then double check PATH: echo $PATH. Here's mine (after the above - your may not have all of these paths, but so long as it has /home/user/.yarn/bin - where user is your username):

/home/user/.yarn/bin:/home/user/bin:/home/user/.local/bin:/usr/lib/git-core:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Jeremy Davis
  • 741
  • 10
  • 16