Angular-cli: ng: command not found

Created on 9 Apr 2017  路  6Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [ X] bug report -> please search issues before submitting
- [ ] feature request

Versions.


node:7.8.0
npm:4.2.0
MacOs Sierra 10.12.14

Repro steps.


Ran in my home directory: npm install -g @angular/cli
fallowed by ng new my-app

Mention any other details that might be useful.


I attempted -bash: ng: command not found #5021 did not correct issue.

Most helpful comment

So it looks like your global node binaries get installed in /usr/local/Cellar/node/6.5.0/libexec/npm/bin, but it's not in your path.

To fix this you can add this line to the file .bashrc in your home dir.

export PATH="/usr/local/Cellar/node/6.5.0/libexec/npm/bin:$PATH"

After adding this and opening a new terminal window, your globally installed npm binaries should work.

All 6 comments

@Cptmorgan27 it looks like the node binaries are not in your path. Can you paste the output of echo $PATH and npm install -g @angular/cli ?

echo $PATH : /Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

npm install -g @angular/cli:
/usr/local/Cellar/node/6.5.0/libexec/npm/bin/ng -> /usr/local/Cellar/node/6.5.0/libexec/npm/lib/node_modules/@angular/cli/bin/ng

[email protected] install /usr/local/Cellar/node/6.5.0/libexec/npm/lib/node_modules/@angular/cli/node_modules/fsevents
node install

[fsevents] Success: "/usr/local/Cellar/node/6.5.0/libexec/npm/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v51-darwin-x64/fse.node" is installed via remote

[email protected] install /usr/local/Cellar/node/6.5.0/libexec/npm/lib/node_modules/@angular/cli/node_modules/node-sass
node scripts/install.js

Cached binary found at /Users/User/.npm/node-sass/4.5.2/darwin-x64-51_binding.node

[email protected] postinstall /usr/local/Cellar/node/6.5.0/libexec/npm/lib/node_modules/@angular/cli/node_modules/node-sass
node scripts/build.js

Binary found at /usr/local/Cellar/node/6.5.0/libexec/npm/lib/node_modules/@angular/cli/node_modules/node-sass/vendor/darwin-x64-51/binding.node
Testing binary
Binary is fine

So it looks like your global node binaries get installed in /usr/local/Cellar/node/6.5.0/libexec/npm/bin, but it's not in your path.

To fix this you can add this line to the file .bashrc in your home dir.

export PATH="/usr/local/Cellar/node/6.5.0/libexec/npm/bin:$PATH"

After adding this and opening a new terminal window, your globally installed npm binaries should work.

@beeman Thanks!! didn't have a .bashrc but had .bash_profile. Now, everything is working.

Closing as above.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jmurphzyo picture jmurphzyo  路  3Comments

rwillmer picture rwillmer  路  3Comments

donaldallen picture donaldallen  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

purushottamjha picture purushottamjha  路  3Comments