Ember-CLI installation not recognized

I have followed the following tutorial and have successfully installed everything except ember-cli. http://www.ember-cli.com/#getting-started

  • node --help (shows output help)
  • npm --help (shows output help messages)
  • npm install -g bower
  • npm install -g phantomjs

All of the above works without issue, but when I try ember new my-new-app

I got the following

$ ember new my-new-app
-bash: ember: command not found

      

When I do $ npm install -g ember-cli

I get the following

$ npm install -g ember-cli
/Users/MGK/.node/bin/ember -> /Users/MGK/.node/lib/node_modules/ember-cli/bin/ember
ember-cli@0.1.4 /Users/MGK/.node/lib/node_modules/ember-cli
β”œβ”€β”€ abbrev@1.0.5
β”œβ”€β”€ js-string-escape@1.0.0
β”œβ”€β”€ debug@2.1.0 (ms@0.6.2)
β”œβ”€β”€ temp@0.8.1 (rimraf@2.2.8)
β”œβ”€β”€ symlink-or-copy@1.0.1 (copy-dereference@1.0.0)
β”œβ”€β”€ http-proxy@1.7.3 (requires-port@0.0.0, eventemitter3@0.1.6)
β”œβ”€β”€ broccoli-writer@0.1.1 (rsvp@3.0.14, quick-temp@0.1.2)
β”œβ”€β”€ yam@0.0.17 (findup@0.1.5, fs-extra@0.8.1, lodash@2.4.1)
└── broccoli-caching-writer@0.5.1 (promise-map-series@0.2.0, rimraf@2.2.8, quick-         temp@0.1.2, rsvp@3.0.14, core-object@0.0.2, broccoli-kitchen-sink-helpers@0.2.5)

      

Any ideas?

Update , here is mineecho $PATH

$ echo $PATH
/Users/MGK/.rvm/gems/ruby-2.1.2/bin:/Users/MGK/.rvm/gems/ruby-2.1.2@global/bin:/Users/MGK/.rvm/rubies/ruby-2.1.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/MGK/.rvm/bin

      

+3


source to share


3 answers


The problem is that the npm path is not in your variable $PATH

, so your shell doesn't know where to look for any of your npm modules. There are several ways to fix this:

  • Run npm config get prefix

    . Open the config file .bash_profile

    or .bashrc

    add the following line:

    export PATH="~/.node/bin:$PATH"

    This will add your npm binaries to your path. ( ~/.node/bin

    taken from the console output when installing ember-cli)

    Then run source ~/.bashrc

    or source ~/.bash_profile

    whichever file you edited. This will download the changes you made to $PATH

    . Or:

  • Run npm config set prefix /usr/local

    ( /usr/local

    since you're on a Mac and it's already in your $ PATH).



(see this question for a more general instance of the same npm install issue.)

+7


source


is there literally that giant gap (tab or spaces) in your path when you run $ PATH?

If so, your path may be damaged due to this gap. based on the PATH you provided, try resetting your PATH. paste this line into your terminal window:



PATH=/Users/MGK/.rvm/gems/ruby-2.1.2/bin:/Users/MGK/.rvm/gems/ruby-2.1.2@global/bin:/Users/MGK/.rvm/rubies/ruby-2.1.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/MGK/.rvm/bin

      

0


source


As @wisew said the problem is the npm path is not set in the path variable!

I faced the same problem on my win7 machine, I fixed the problem by adding "C:\Users\username\AppData\Roaming\npm"

to the path variable as shown below.

  1. open command prompt ( cmd

    ) and runsetx "%path%;C:\Users\username\AppData\Roaming\npm"

  2. Open again cmd

    to confirm changes
  3. run command ember

You should see that the ember command is detected and working :)

Thank!

0


source







All Articles