Ionic-cli: -bash: ionic: command not found

Created on 3 Nov 2019  路  5Comments  路  Source: ionic-team/ionic-cli

Bug Report

Ionic version:


[x] 4.x

Current behavior:

Just heard you support React and attempted the installation to start learning.
So all I did was: npm install -g ionic@latest
It did install with a warning as below:

 npm WARN deprecated [email protected]: Please note that v5.0.1+ of superagent removes User-Agent header by default, therefore you may need to add it yourself (e.g. GitHub blocks requests without a User-Agent header).  This notice will go away with v5.0.2+ once it is released.
  /usr/local/Cellar/node/11.7.0/bin/ionic -> /usr/local/Cellar/node/11.7.0/lib/node_modules/ionic/bin/ionic
+ [email protected]
 added 235 packages from 145 contributors in 27.975s

But then when I run:

ionic start my-app

It returns: -bash: ionic: command not found
Expected behavior:

Well, it should create the app in the designated directory.
Steps to reproduce:

Related code:

Other information:

Ionic info:

Node version : v10.16.3
npm version: 6.9.0
unable to run any ionic command

triage

Most helpful comment

@BernardA This is an issue with your npm environment. Run the following to see where npm will put runnable scripts:

npm bin -g

Then, ensure that the outputted directory exists in PATH environment variable:

echo $PATH

If it isn't, you have to add it using .bashrc file.

All 5 comments

@BernardA This is an issue with your npm environment. Run the following to see where npm will put runnable scripts:

npm bin -g

Then, ensure that the outputted directory exists in PATH environment variable:

echo $PATH

If it isn't, you have to add it using .bashrc file.

@dwieeb The directory wasn't on .bashprofile.
I added it like so:
export PATH="/usr/local/Cellar/node/11.7.0/bin"
Thanks

@BernardA By doing that you're completely overwriting your PATH.

okay, the problem is not with ionic.
Here's a fix I came up with. First clear the cache from npm.
npm cache clean --force
after that run
npm install -g ionic
if you're on mac include sudo.

Add into .bashrc file [C:\Users\you_user_path*.bashrc*]:

alias ionic='C:\\Users\\you_user_path\\AppData\\Roaming\\npm\\ionic.cmd'

Save and close all prompts. Test!
;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rashnk picture rashnk  路  3Comments

bazigatabassum picture bazigatabassum  路  3Comments

jgw96 picture jgw96  路  3Comments

chsakell picture chsakell  路  3Comments

phyr0s picture phyr0s  路  3Comments