Cannot run ionic. receives “No command 'ionic' found”

前端 未结 13 1308
灰色年华
灰色年华 2020-12-14 08:11

I want to start using the ionic framework, but unfortunately I\'m already failing on the first step.

I am running Ubuntu 13.04 and I have node v0.10.25 installed. I\

相关标签:
13条回答
  • 2020-12-14 08:52

    First Solution

    I recently ran into this issue and the only solution that worked for me was to uninstall both ionic and cordova.

    npm uninstall -g cordova
    npm uninstall -g ionic
    

    Then just reinstall

    npm install -g cordova
    npm install -g ionic 
    

    Second Solution

    I ran into this issue again! This time check your environmental variables.

    Run npm bin -g and check if the path returned is in your environmental variables. For me, it prompted that it was not found in the terminal output. I added that path to the environmental variables and restarted the terminal. From there everything started to work again. (source)

    0 讨论(0)
  • 2020-12-14 08:58

    this worked for me. try adding below to the ~/.bash_profile for mac OSX el capitan users:

    NPM_PACKAGES="${HOME}/.npm-packages"
    
    NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
    
    PATH="$NPM_PACKAGES/bin:$PATH"
    # Unset manpath so we can inherit from /etc/manpath via the `manpath`
    # command
    unset MANPATH # delete if you already modified MANPATH elsewhere in your config
    MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
    

    then run source ~/.bash_profile to reload the profile in terminal.

    additional info: node v4.3.1

    0 讨论(0)
  • 2020-12-14 08:59

    I also faced same problem but i solved i used following commands on terminal it worked

    • sudo npm uninstall ionic

      then  i used
      

    sudo npm install -g cordova ionic@latest

    and it worked fine it automatically installs best stabel version of cordova and latest stable version of ionic . for me it installed ionic 3.7.0 and cordova 7.0.1

    0 讨论(0)
  • 2020-12-14 09:00

    for some of you, the two answer above might not work. here's a more general solution for situation where you see "XX" command not found

    first check your npm root and npm root -g the result for the npm root -g should be something like "/usr/local". if it's not, then you found your problem.

    change it by:

    npm config set prefix /usr/local
    

    then npm root -g should give you something like /usr/local/lib/node_modules . Then go ahead re-install everything with -g you will be good to go!

    0 讨论(0)
  • 2020-12-14 09:04

    The package name has changed from ionic to @ionic/cli! To update, run: npm uninstall -g ionic Then run: npm i -g @ionic/cli

    0 讨论(0)
  • 2020-12-14 09:04

    For Mac users

    1. install the ionic

    npm i -g @ionic/cli
    

    2. check npm path

    npm root -g
    

    3. copy full path of ionic

    Ex. /usr/local/Cellar/node/15.2.1/lib/node_modules/@ionic/cli/bin

    4. open this file as administrator "/etc/paths" with nano or whatever editor

    Ex. sudo nano /etc/paths

    5. Add ionic bin file full path to file ends. And save file.

    That's it.

    0 讨论(0)
提交回复
热议问题