Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Ubuntu says No command 'ionic' found after installing Ionic

ErrorNo command 'ionic' found

Short answer

The shell finds ionic only if the Ionic CLI is installed globally and npm's global bin folder is on PATH. The package is @ionic/cli, not the old ionic package. Check what sits in npm's global folder, then install the right package, add the bin folder to PATH, or reinstall it under the Node.js version you now use.

  • Applies to Ionic CLI, npm 10, Node.js 22, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find npm's global folder and see which packages it holds. The result tells you whether the CLI is missing or only hidden.

    npm prefix -g
    ls "$(npm prefix -g)/lib/node_modules"
  2. 2Match what you see, then jump to its fix

    1. 1The listing has no @ionic folder, or it shows a folder named ionic.The Ionic CLI is not installed, or the old package is installedFix
    2. 2The @ionic folder exists in the listing, but command -v ionic prints nothing.npm's global bin folder is not on PATHFix
    3. 3ionic worked before. After nvm use or a new terminal, node -v shows a different version and the listing no longer has @ionic.You installed it under another Node.js version (nvm)Fix

What does the error look like?

  • No command 'ionic' found
  • ionic: command not found

Cause 1 of 3

The Ionic CLI is not installed, or the old package is installed

1Check

The CLI is published as @ionic/cli. Ionic's docs say an older install must be removed first because the package name changed, so a global package called ionic is the old one.

ls "$(npm prefix -g)/lib/node_modules"

2Fix

Remove the old package if it is there, then install @ionic/cli. If npm stops with an EACCES error, do not use sudo: set up npm's global folder in your home directory (see the next cause).

npm uninstall -g ionic
npm install -g @ionic/cli

3Verify

The shell now finds the command.

command -v ionic

Confirmed by ionicframework.com

Did this fix it?

Cause 2 of 3

npm's global bin folder is not on PATH

1Check

npm links the executables of global packages into the bin folder under its prefix, and that folder must be on PATH. Compare PATH with the prefix.

echo "$(npm prefix -g)/bin"
echo "$PATH" | tr ':' '\n'

2Fix

Add that bin folder to PATH. npm's own guide for avoiding sudo moves the prefix to ~/.local and puts ~/.local/bin on PATH in ~/.profile. With zsh, also source ~/.profile from ~/.zprofile.

npm config set prefix ~/.local
echo 'PATH=~/.local/bin:$PATH' >> ~/.profile
source ~/.profile
npm install -g @ionic/cli

3Verify

Open a new terminal and look for the command.

command -v ionic

Confirmed by docs.npmjs.com

Did this fix it?

Cause 3 of 3

You installed it under another Node.js version (nvm)

1Check

With nvm, each installed Node.js version has its own global packages folder under ~/.nvm/versions/node. A different active version, or a new shell that starts with the default alias, uses another folder.

node -v
npm prefix -g

2Fix

Reinstall the CLI under the version you want to use, and set that version as the default for new shells.

nvm use node
npm install -g @ionic/cli
nvm alias default node

3Verify

Open a new terminal and look for the command.

command -v ionic

Confirmed by raw.githubusercontent.com

Did this fix it?

How do I stop it coming back?

  • Install global CLIs without sudo, with npm's prefix in your home directory, so the folder is yours and on PATH.
  • Pick one Node.js manager (nvm or the system package) and stay with it.
  • Set the nvm default alias, so new terminals and editors start with the Node.js version that has your global tools.
  • Keep a short setup note in the repository with the install command for the Ionic CLI.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

adb tcpip 5555 fails because no device is found

adb: more than one device/emulator

adb tcpip only works while the device is attached and listed by adb, because it tells the phone to start listening on port 5555.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.