ng: command not found
After installing angular-cli with the help of this https://github.com/angular/angular-cli/issues/389#issuecomment-213420501 i installed Angular-cli successfully.
After that i tried a ng command ng --help what gave me the following message. -bash: ng: command not found
Running npm list -g --depth=0 shows me that angular-cli is installed.
ReinosMac:~ reinos$ npm list -g --depth=0
/Users/reinos/.npm/lib
├── [email protected]
├── [email protected]
└── [email protected]
Running on a Macos.
Am i missing something?
Why is this marked as closed? This issue happened for me today on an Ubuntu server using Node (not NVM)
There was no 'lib' folder in /home/[user]/.npm/lib for me to symlink
I ended up removing node and installing nvm, but that can't be an acceptable solution, right?
@AlexReff -- is your PATH as noted in the referenced NPM 13828 issue correct?
That topic is specific to Windows. This was not on a Windows platform.
Still occuring with node v5.6.0 npm v3.6.0. Using alias fix.
I changed the alias, now I get this error, now how do I undo the alias?
-bash: /root/.nvm/versions/node/v6.3.1/lib/node_modules/angular-cli/bin/ng: No such file or directory
and Mac Users do not try to change the alias, it wont solve the problem
I know it's frustrating to hear, but there isn't much that we can do here on this repo. If after global install the ng isn't available, it means that either the install failed or that your npm is broken/misconfigured/having problems. Those kind of issues should be filed against https://github.com/npm/npm
Same problem here using Windows 10 and actual installer.
Same problem with it. npm command is working fine, so the problem is with angular-cli as ng command is ot working
Same problem here running Windows 10 x64 / NodeJS 6.9.1 / npm 3.10.9: After installation of Angular CLI via npm, the 'ng' command cannot be found.
Uninstalled npm with npm uninstall -g npm Uninstalled NodeJS via control panel / programs and features Downloaded and ran 'old' NodeJS installer release 6.5.0 from https://nodejs.org/download/release/v6.5.0/ (node-v6.5.0-x64.msi). After NodeJS 6.5.0 installation completed, open powershell and npm install -g angular-cli Grab quick coffee After installation completed, ng worked OK.
HTH
Thank you. This solution works for me
Hi,
I was also coming across this issue on the MacOS Siera (10.12.2), and I managed to fix the issue following the next steps (I provided the whole steps to install the angular-cli, including the way to add the correct link into ~/.bash_profile
Prerequisites the following versions need to be installed (https://www.npmjs.com/package/angular-cli#prerequisites )
- Node 4 or higher
- NPM 3 or higher
Because I installed the node and npm using the brew package manager I would go with it for updating the node and npm to the required versions
-
$ brew update && brew upgrade node && npm install -g npm -
Check the versions with
$ node --version
$ npm --version
Installation
- Install the angular-cli
$ npm install -g angular-cli
-
Try to see if the ng is successfully installed on your machine with:
$ ng --versionIn same cases (this was also my cases) the packages are successfully installed but the ng command is not seen in command prompt (See the filed issue https://github.com/angular/angular-cli/issues/503 ). If this is the case follow the following instructions: -
See where are the angular-cli installations
$ npm link angular-cliOn my machine the command returns /Users/antonelpazargic/.npm-packages/lib/node_modules/angular-cli/node_modules/angular-cli -> /Users/antonelpazargic/.npm-packages/lib/node_modules/angular-cli -
Edit the ~/bash_profile in order to include a link to one of the link command return paths + /bin/ng For me:
alias ng="/Users/xxxxxxxx/.npm-packages/lib/node_modules/angular-cli/bin/ng" -
$ . ~/bash_profile -
Test the installation with
$ ng --version
If your IDE is like mine (Cloud 9) the node version default may be something like 4.5.1. Do an upgrade to at least version 6.5.0 as shown above. In addition your IDE may shut your work space session down after being idle. That may reset everything back to the default node version. You can use this command to set the current session to the node version you need.
$ nvm use 6.5.0
This worked for me and 'ng' commands were back and life was good again.
With the latest @angular/cli package (prev called angilar-cli and renamed @angular/cli)
I think nvm is a good workaround, but you just have to add this line to your bash-profile:
open ~/.bash_profile
alias ng="/Users/xxxxx/.npm-packages/lib/node_modules/@angular/cli/bin/ng"
open ~/.zshrc alias ng="~/lib/node_modules/@angular/cli/bin/ng"
Update.....
I started a new MEAN stack node.js app on Cloud 9 (Ubuntu) and when using node 6.5.0 got a message that I should convert to 6.10. Used 6.10.1 and that would not recognize 'ng' commands. Changing this 'bash_profile' may or may not be possible developing from an IDE tool where you don't own the file. So I went back to 6.5.0 and it worked fine. I don't understand why the new 6.10.1 version would cause the 'ng' script file to not be found. I'm sticking with 6.5.0 for now warning or not at least it works.
Also posible solution is to reexport (or to verify) path to your .../usr/bin:
export PATH=$HOME/bin:$PATH
Are you talking about setting this PATH inside of my application? Not om my machine? I use a cloud service to create my code which sits on Ubuntu. Where would I set the PATH? In which project file?
B
I was talking about bin folder which contains refs on cli(s).
Being in the Home directory, simply running:
alias ng="npm/lib/node_modules/angular-cli/bin/ng"
In terminal did fix the issue
I was running node v4.5.0. Updating to v8.1.1 fixed the issue for me.