No command found 'ember'

Looks like I messed up the ember-cli installation. I installed npm using sudo, but after reading some issues with ember-cli and sudo on npm, I went to uninstall and reinstalled the following instruction here https://gist.github.com/isaacs/579814 .

Now I have installed ember-cli via npm install -g ember-cli

, but when I do ember new <name>

I get

There is no 'ember' command, you meant:

Command 'enber' from package 'asn1c' (universe)

ember: command not found

I can do that node

$ which node

/ home / [user] / local / bin / node

and which npm

$ which npm

/ home / [user] / local / bin / im

but I see that ember exists in the following path, which is installed:

npm install -g ember-cli

/ home / [user] / npm / bin / ember → / home / [user] / npm / lib / node_modules / ember-cli / bin / ember

Any ideas on how to get the ember command to work?

+3


source to share


3 answers


You need to make sure it /home/[user]/npm/bin

is in your shell path. You can echo $PATH

see if it is enabled.

For Bash:

Add this to your .bashrc

or.bash_profile

PATH=/home/[user]/npm/bin:$PATH

      

Then restart your terminal or run source ~/.bashrc



For ZSH:

Add this to your .zshrc`

path+=('/home/[user]/npm/bin')

      

Then restart your terminal or run source ~/.zshrc

You will need to replace [user]

the path with your username on your computer.

+1


source


Another approach is to use nvm . This gives you the ability to easily manage node.js / npm versions without sudo, as well as manage installed packages. One drawback (or maybe not?) Is that you need to install packages for each node version separately.



+2


source


The accepted answer works. If I do not agree with the use of ~/.bashrc

or ~/.bash_profile

. ~/.bashrc

used only for invalid shells, but ~/.bash_profile

used for login systems.

I advise you to export to $PATH

in ~/.profile

, which will be available for the entire desktop session.

Hence, you should add something like

export PATH=$PATH:/home/[user]/npm/bin

      

before ~/.profile

for best results

0


source







All Articles