angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng is not recognized as valid command even after successful npm install

Open indcoder opened this issue 10 years ago • 52 comments

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Windows 10
  1. Versions. Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version And paste the result here. v5.9.1

  2. Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc. 'ng' is not recognized as an internal or external command, operable program or batch file.

  3. The log given by the failure. Normally this include a stack trace and some more information. Th angular cli version +-- [email protected]

  4. Mention any other details that might be useful.


    Thanks! We'll be in touch soon.

indcoder avatar Jun 20 '16 19:06 indcoder

Use NodeJS command prompt rather Windows Command, NodeJs command prompt will recognize ng.

untitled

Shrutikarekal123 avatar Jun 21 '17 07:06 Shrutikarekal123

Just open your command prompt (run as administrator). Ensure node --v is 6.9.0 or higher and npm --v is 3.0.0 r higher.

After that run the following command:

npm install -g @angular/cli

Once angular is installed. you can see an entry of angular cli in the path

C:\Users\Dell\AppData\Roaming\npm\node_modules@angular

Then try ng help. It will work.

gautamjgithub avatar Jun 28 '17 13:06 gautamjgithub

When installing Angular Cli from Windows Power Shell with administrative privileges it doesn't create the global variable, the solution was add it manually. Just go to Enviroment Variables and add in the Path variable the directory for the NG exe. In my case, the path was "C:\NPM-Package", after doing so, you have to restart your computer in order to apply the changes.

PaulaOliveiraM avatar Jul 02 '17 13:07 PaulaOliveiraM

There is an error in ng... I tried npm cache clean uninstall and installed again but there is no use and also i changed the path C:\Users\admin\AppData\Local\atom\bin;C:\Users\admin\AppData\Roaming\npm;C:\ProgramData\admin\atom\bin and also C:\Users\admin\AppData\Roaming\npm\node_modules@angular\cli\bin\ng..

npm install -g @angular/cli npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\webpack\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) ng -v 'ng' is not recognized as an internal or external command, operable program or batch file. node -v v6.10.1 npm -v 3.10.10 There is no use in this changes..Iam using windows 7..Help me to solve these issues

dhanabalu avatar Jul 05 '17 06:07 dhanabalu

I'm gonna have to chime in regarding the admin install: you definitely shouldn't not use admin privileges for npm installs, it leads to a lot of problems. You can read more about it here: https://docs.npmjs.com/getting-started/fixing-npm-permissions.

filipesilva avatar Jul 05 '17 18:07 filipesilva

C:\Users\Vivek Ghanchi>npm list -g --depth=0 C:\Users\Vivek Ghanchi\AppData\Roaming\npm `-- @angular/[email protected]

C:\Users\Vivek Ghanchi>ng 'ng' is not recognized as an internal or external command, operable program or batch file. I am running on windows10 can any solve this problem

ghost avatar Jul 06 '17 03:07 ghost

For those using windows 7, gautamjgithub's recommendation works.

raferbop avatar Jul 07 '17 21:07 raferbop

At last find the solution for ng command is not working issue ,Find the solution below http://itechiesol.blogspot.com/2017/07/angular-cli-ng-command-is-not-working.html

naru6be avatar Jul 22 '17 13:07 naru6be

In my case, my ng command was working but i have deleted line registry https://registry.npmjs.org/=true using npm config edit and it stopped working. When i have added that line again command started working again.

dhaniksahni avatar Nov 27 '17 15:11 dhaniksahni

Hello,

I installed the MEAN stack locally (without -g option) in my home directory. Now bash does not find ng command. I found it in my node_modules directory, under the path: ~/node_modules/@angular/cli/bin but to use it I have to type (e.g.) "./ng --version"

This is my npm list --depth=0 output (from my home dir in bash): npm_list

And this is the "./ng --version" output ng_version

ubgen avatar Nov 28 '17 15:11 ubgen

ng command mostly works fine with windows command prompt but it has some dependency issues with VS code or other editor, although we have installed the dependency for ng using npm install -g angular/cli Currenty my Node version is v8.9.4 and npm version is v5.6.0

Try executing ng new [projectName] using command prompt, it will work.

Pushp1992 avatar Jan 29 '18 13:01 Pushp1992

I have faced and fixed this issue relates node-sass and python error.Try installing latest angular cli command with the steps below

Set the system variable path as well: C:\Users\windowsusername\AppData\Roaming\npm

C:\Users\windowsusername\AppData\Roaming\npm\node_modules@angular\cli\bin;

C:\Program Files\nodejs;

Then start using angular cli command prompt using: angular client project folder path>npm install -g @angular/cli@latest

angular client project folder path>npm install -g node-gyp

SatishMHiremath avatar Feb 17 '18 17:02 SatishMHiremath

(All this on Windows 10 ) 1.-Uninstall Node from computer, 2.-Remove this folders (npm and npm-cache) >C:\Users\YourPcName\AppData\Roaming\npm and >C:\Users\YourPcName\AppData\Roaming\npm-cache 3. Install the Latest Version, in my case was node 10.5.0 4.- Open cmd and run npm install -g @angular/cli and this work for me

anamarquezz avatar Jun 29 '18 02:06 anamarquezz

is easy

add to environment variables your path to ng in my case C:\Users\Administrador\AppData\Roaming\npm

in command prompt type PATH

now it Works !

gjgiraldo avatar Aug 20 '18 18:08 gjgiraldo

it works for me as 1- in command prompt type PATH 2- type ng 3-close command and open it for the folder path and create new project by angular by type ng new app2

mahmoudelkhadragy avatar Oct 03 '18 13:10 mahmoudelkhadragy

i am finding an error in visual studio code, here when i run my programs on react, those will give problems to display my program in chrome i am getting a texual examination for all the programs i write so what can i do?

srigowrideo avatar Dec 01 '18 06:12 srigowrideo

For react mpn works and for angular ng works. So, try npm start for react and ng serve for angular. it would be great if you can attach screenshot of the error.

Thanks and regards, Pushp Singh Mob: +91-958-498-9057 Linkedin: https://www.linkedin.com/in/pushp-singh-1a83b336/ https://www.linkedin.com/in/pushp-singh-1a83b336/

On Sat, Dec 1, 2018 at 12:36 PM Srigowri Deogirikar < [email protected]> wrote:

[image: Boxbe] https://www.boxbe.com/overview This message is eligible for Automatic Cleanup! ([email protected]) Add cleanup rule https://www.boxbe.com/popup?url=https%3A%2F%2Fwww.boxbe.com%2Fcleanup%3Fkey%3DyYmh%252F8sRv6KRFfjNiNZ6Usa%252FUBSvKpE8MtBVtLfAGeU%253D%26token%3DvDyZhWiscK0m7Cs9aUn9OoPq%252F3DwMP6uCPS3REYVUPds%252BPzrr%252B%252B9YzneAROoBoRmYgAtrf96lmCm3BbVizmWj9CcZHSUn0sGZSUgaYTNDst%252BgqBRL%252FdoB%252Fr5G%252BOibm5CZ%252FMszucgmUdAUP8jRVJBEQ%253D%253D&tc_serial=45712512601&tc_rand=634959056&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001 | More info http://blog.boxbe.com/general/boxbe-automatic-cleanup?tc_serial=45712512601&tc_rand=634959056&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001

i am finding an error in visual studio code, here when i run my programs on react, those will give problems to display my program in chrome i am getting a texual examination for all the programs i write so what can i do?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/1149#issuecomment-443404994, or mute the thread https://github.com/notifications/unsubscribe-auth/APmL-Ah0qVFc10emoaSTeQDNSqvgL9Z4ks5u0id_gaJpZM4I6C3G .

Pushp1992 avatar Dec 01 '18 08:12 Pushp1992

How to do that??

On Sat, Dec 1, 2018, 1:31 PM Pushp Singh <[email protected] wrote:

For react mpn works and for angular ng works. So, try npm start for react and ng serve for angular. it would be great if you can attach screenshot of the error.

Thanks and regards, Pushp Singh Mob: +91-958-498-9057 Linkedin: https://www.linkedin.com/in/pushp-singh-1a83b336/ https://www.linkedin.com/in/pushp-singh-1a83b336/

On Sat, Dec 1, 2018 at 12:36 PM Srigowri Deogirikar < [email protected]> wrote:

[image: Boxbe] https://www.boxbe.com/overview This message is eligible for Automatic Cleanup! ([email protected]) Add cleanup rule < https://www.boxbe.com/popup?url=https%3A%2F%2Fwww.boxbe.com%2Fcleanup%3Fkey%3DyYmh%252F8sRv6KRFfjNiNZ6Usa%252FUBSvKpE8MtBVtLfAGeU%253D%26token%3DvDyZhWiscK0m7Cs9aUn9OoPq%252F3DwMP6uCPS3REYVUPds%252BPzrr%252B%252B9YzneAROoBoRmYgAtrf96lmCm3BbVizmWj9CcZHSUn0sGZSUgaYTNDst%252BgqBRL%252FdoB%252Fr5G%252BOibm5CZ%252FMszucgmUdAUP8jRVJBEQ%253D%253D&tc_serial=45712512601&tc_rand=634959056&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001

| More info < http://blog.boxbe.com/general/boxbe-automatic-cleanup?tc_serial=45712512601&tc_rand=634959056&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001

i am finding an error in visual studio code, here when i run my programs on react, those will give problems to display my program in chrome i am getting a texual examination for all the programs i write so what can i do?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/angular/angular-cli/issues/1149#issuecomment-443404994 , or mute the thread < https://github.com/notifications/unsubscribe-auth/APmL-Ah0qVFc10emoaSTeQDNSqvgL9Z4ks5u0id_gaJpZM4I6C3G

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/1149#issuecomment-443408305, or mute the thread https://github.com/notifications/unsubscribe-auth/Ae0jrxxUKTTdi0xNfC90pC-Xf1_c50c0ks5u0jdBgaJpZM4I6C3G .

srigowrideo avatar Dec 01 '18 08:12 srigowrideo

Fir taking screenshot, you can use your laptop shortcut key it take photo of error and send

On Sat, Dec 1, 2018, 1:50 PM Srigowri Deogirikar <[email protected] wrote:

[image: Boxbe] https://www.boxbe.com/overview This message is eligible for Automatic Cleanup! ([email protected]) Add cleanup rule https://www.boxbe.com/popup?url=https%3A%2F%2Fwww.boxbe.com%2Fcleanup%3Fkey%3DhA9htyCUzY5z9oX0gF8ejMVkG925LhsawvZuJo%252F6570%253D%26token%3DnjF24StikVk%252FypSdOlzhdQS%252FAoVAJ1HvY4mjIZI9vhMyS8nvx6f4Z%252BqM%252FGKBYZ6m5endDs89WRhjU69F9I%252FIk8fRVBH3Ij4FdVVBegkoDpu2XmuxtLSqBYyUjbiAnZP8Myt32pnigsEorxrJ09qWyw%253D%253D&tc_serial=45714200076&tc_rand=528229139&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001 | More info http://blog.boxbe.com/general/boxbe-automatic-cleanup?tc_serial=45714200076&tc_rand=528229139&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001 How to do that??

On Sat, Dec 1, 2018, 1:31 PM Pushp Singh <[email protected] wrote:

For react mpn works and for angular ng works. So, try npm start for react and ng serve for angular. it would be great if you can attach screenshot of the error.

Thanks and regards, Pushp Singh Mob: +91-958-498-9057 Linkedin: https://www.linkedin.com/in/pushp-singh-1a83b336/ https://www.linkedin.com/in/pushp-singh-1a83b336/

On Sat, Dec 1, 2018 at 12:36 PM Srigowri Deogirikar < [email protected]> wrote:

[image: Boxbe] https://www.boxbe.com/overview This message is eligible for Automatic Cleanup! ([email protected]) Add cleanup rule <

https://www.boxbe.com/popup?url=https%3A%2F%2Fwww.boxbe.com%2Fcleanup%3Fkey%3DyYmh%252F8sRv6KRFfjNiNZ6Usa%252FUBSvKpE8MtBVtLfAGeU%253D%26token%3DvDyZhWiscK0m7Cs9aUn9OoPq%252F3DwMP6uCPS3REYVUPds%252BPzrr%252B%252B9YzneAROoBoRmYgAtrf96lmCm3BbVizmWj9CcZHSUn0sGZSUgaYTNDst%252BgqBRL%252FdoB%252Fr5G%252BOibm5CZ%252FMszucgmUdAUP8jRVJBEQ%253D%253D&tc_serial=45712512601&tc_rand=634959056&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001

| More info <

http://blog.boxbe.com/general/boxbe-automatic-cleanup?tc_serial=45712512601&tc_rand=634959056&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001

i am finding an error in visual studio code, here when i run my programs on react, those will give problems to display my program in chrome i am getting a texual examination for all the programs i write so what can i do?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/angular/angular-cli/issues/1149#issuecomment-443404994

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/APmL-Ah0qVFc10emoaSTeQDNSqvgL9Z4ks5u0id_gaJpZM4I6C3G

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/angular/angular-cli/issues/1149#issuecomment-443408305 , or mute the thread < https://github.com/notifications/unsubscribe-auth/Ae0jrxxUKTTdi0xNfC90pC-Xf1_c50c0ks5u0jdBgaJpZM4I6C3G

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/1149#issuecomment-443408992, or mute the thread https://github.com/notifications/unsubscribe-auth/APmL-ORvcXP1Lb2UXE5Iuj4ajXpea1kTks5u0joogaJpZM4I6C3G .

Pushp1992 avatar Dec 01 '18 08:12 Pushp1992

I am not able to debug the program in visual studio code , I came across that we need to change the port of the local host but I don’t know how to change the port of the local host so I felt it’s taking dummy variable than my code , here is the problem Sent from my iPhone

On Dec 1, 2018, at 1:31 PM, Pushp Singh [email protected] wrote:

For react mpn works and for angular ng works. So, try npm start for react and ng serve for angular. it would be great if you can attach screenshot of the error.

Thanks and regards, Pushp Singh Mob: +91-958-498-9057 Linkedin: https://www.linkedin.com/in/pushp-singh-1a83b336/ https://www.linkedin.com/in/pushp-singh-1a83b336/

On Sat, Dec 1, 2018 at 12:36 PM Srigowri Deogirikar < [email protected]> wrote:

[image: Boxbe] https://www.boxbe.com/overview This message is eligible for Automatic Cleanup! ([email protected]) Add cleanup rule https://www.boxbe.com/popup?url=https%3A%2F%2Fwww.boxbe.com%2Fcleanup%3Fkey%3DyYmh%252F8sRv6KRFfjNiNZ6Usa%252FUBSvKpE8MtBVtLfAGeU%253D%26token%3DvDyZhWiscK0m7Cs9aUn9OoPq%252F3DwMP6uCPS3REYVUPds%252BPzrr%252B%252B9YzneAROoBoRmYgAtrf96lmCm3BbVizmWj9CcZHSUn0sGZSUgaYTNDst%252BgqBRL%252FdoB%252Fr5G%252BOibm5CZ%252FMszucgmUdAUP8jRVJBEQ%253D%253D&tc_serial=45712512601&tc_rand=634959056&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001 | More info http://blog.boxbe.com/general/boxbe-automatic-cleanup?tc_serial=45712512601&tc_rand=634959056&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001

i am finding an error in visual studio code, here when i run my programs on react, those will give problems to display my program in chrome i am getting a texual examination for all the programs i write so what can i do?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/1149#issuecomment-443404994, or mute the thread https://github.com/notifications/unsubscribe-auth/APmL-Ah0qVFc10emoaSTeQDNSqvgL9Z4ks5u0id_gaJpZM4I6C3G .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

srigowrideo avatar Dec 01 '18 12:12 srigowrideo