Ann
Ann

Reputation: 9

ubuntu 18.04- ember: command not found

I know this has been addressed before, but I've tried the advice on No command 'ember' found and it hasn't worked for me.

I'm trying to install EmberJs for a techtest and I keep getting 'Command 'ember' not found'. I'm on Ubuntu 18.04, and have checked all my paths as follows.

When I run npm install -g ember-cli it installs and shows:

npm WARN deprecated [email protected]: Please replace with usage of 
fs.existsSync
/home/[user]/.npm-global/bin/ember -> 
/home/[user]/.npm-global/lib/node_modules/ember-cli/bin/ember
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] 
(node_modules/ember-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 
[email protected]: wanted {"os":"darwin","arch":"any"} (current: 
{"os":"linux","arch":"x64"})
+ [email protected]
updated 1 package in 14.662s

So I've definitely got it installed. When I run which npm/ which node I get the following respectively:

/usr/bin/npm
/usr/bin/node

When I run echo $PATH I get:

/home/[user]/npm_global/bin:/usr/local/share/npm/bin:
/usr/local/bin:/usr/local/sbin:~/bin:/usr/share/rvm/gems/ruby-2.3.7/
bin:/usr/share/rvm/gems/ruby-2.3.7@global/bin:/usr/share/rvm/rubies/
ruby-2.3.7/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
sbin:/bin:/usr/games:/usr/local/games:/usr/bin:/snap/bin:/usr/
share/rvm/bin

Andddd I have these paths in my bashrc:

export PATH="/usr/local/share/npm/bin:/usr/local/bin:/usr/local/sbin:~/bin:$PATH"

and

export PATH="/home/[user]/npm_global/bin:$PATH"

I realise this is a lot of info, I'm new to this so wanted to give as much as I could. Any suggestions very much appreciated, thank you!

Upvotes: 0

Views: 1229

Answers (1)

mistahenry
mistahenry

Reputation: 8744

The error you are experiencing means that ember is not in the path. It's really irrelevant if you've installed with npm or downloaded the files manually for the purposes of properly setting up your path. When you encounter a PATH issue the solution is quite simple.

  1. Find the executable. find / -name ember if you want to include symlinks, or just find -type f -name ember if you want only the actual location (npm installs will install in their own managed directory and then symlink to the typical location for binary files such as /usr/local/bin on macOS)

  2. Once found, use your shell's properties file like bashrc to append the directory containing the executable to the $PATH variable.

It's as simple as that. Binary files that are found in your $PATH can be executed. Make sure you see the path to ember there, or manually add the full path that you find in step 1 to your $PATH in bashrc with export PATH=$PATH_TO_DIR_WITH_EMBER_BIN:$PATH which concatenates to the existing $PATH variable

Upvotes: 1

Related Questions