Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
indcoder opened this issue Jun 20, 2016 · 52 comments
Closed
Labels
needs: more info Reporter must clarify the issue

Comments

@indcoder
Copy link

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 indcoder changed the title ng is not recognized as valid command even successful npm install ng is not recognized as valid command even after successful npm install Jun 20, 2016
@bentolor
Copy link

I did the following:

  1. Download https://nodejs.org/dist/v6.2.2/node-v6.2.2-x64.msi
  2. Install
  3. [Windows key], type "command prompt", right click "Run as Administrator"
  4. npm install -g angular-cli

Open a termina. Run ng. Works

@filipesilva
Copy link
Contributor

I'm running it on windows 10 as well, and didn't need to run it as an administrator.

@indcoder Can you give me the console log from when you did npm install -g angular-cli?

@filipesilva filipesilva added the needs: more info Reporter must clarify the issue label Jun 21, 2016
@ramon26cruz
Copy link

I still get the same problem

@indcoder
Copy link
Author

indcoder commented Jun 23, 2016

Hi @filipesilva

Thanks for looking into this.

I don't have the logs of the previous install but I ran the npm install again

C:\Users\xxxxxxx\AppData\Roaming\npm\ng -> C:\Users\xxxxxxx\AppData\Roaming\npm\node_modules\angular-cli\bin\ng
 C:\Users\xxxxxxx\AppData\Roaming\npm
`-- [email protected]

I think the ng bin is not getting added to the path

AC

@indcoder
Copy link
Author

Hi @filipesilva Do you still need more info from my end?

@indcoder
Copy link
Author

I tried to install as an Administrator and I get this error.
npm-debug.zip

@indcoder
Copy link
Author

Upgraded to node v6.2.2 but same error has above....but a big improvement. ng command is working
but throws an error.

ng --help
module.js:442
throw err;
^

Error: Cannot find module 'rsvp'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (C:\Users\Augustine\AppData\Roaming\npm\node_modules\angular-cli\node_modules\leek\lib\leek.js:3:19)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)

@indcoder
Copy link
Author

indcoder commented Jul 1, 2016

Ok so I upgraded my node from 5.* to 6.2.2. Nuked the .npm and .npm-cache folders and then installed ng. It works correctly.

I think:

  1. There is some incompatibility between node 4 or 5.
  2. Multiple npm install of angular cli messed up the other npm modules.

@filipesilva
Copy link
Contributor

Sorry it took me a while to get back to you. Weird bug overall, am glad you got it to work.

The missing rsvp module is this issue: #1186, it should be fixed next beta.

@sthallapelly
Copy link

Hi,
I'm facing the same issue with v4.5.0. I want to work on this stable version, is there any way to fix "ng not recognized" error in 4.5.0?

@filipesilva
Copy link
Contributor

@sthallapelly if you get that message, it means that the npm install failed. Can you open a new issue with the log you get from running the command?

@Dbharali
Copy link

I am also getting the same error: 'ng' is not recognized as an internal or external command,
operable program or batch file. Plz guide on how to resolve this..

Thanks in advance

@bonganintshwanti
Copy link

I'm getting the same problem< 'ng' is not recognized as an internal or external command,
operable program or batch file

@kingshreyash
Copy link

Hi, I installed Nodes 7.2.1, which is latest as of now.
Now for Angular 2, i ran command npm install -g angular-cli
But, ng command is not being recognized.

Am stuck here. please help

@JanStureNielsen
Copy link

@kingshreyash -- this issue is closed. If you have a bug or feature to report, please open a new issue but it sounds like you have a support question which should be directed to StackOverflow.

@kingshreyash
Copy link

kingshreyash commented Dec 13, 2016 via email

@LunaBawa
Copy link

LunaBawa commented Feb 5, 2017

Hello philipo this is what am getting any help

C:\Users\USER>ng --version
'ng' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\USER>node --version
v6.9.5

@himanshu331
Copy link

Hi, I installed Nodes 7.2.1, which is latest as of now.
Now for Angular 2, i ran command npm install -g angular-cli
But, ng command is not being recognized.

Am stuck here. please help

@stevenjiangnz
Copy link

i had similar issue, did a nvm check, found the terminal and the ide were running on different version of node

@amyDoxy
Copy link

amyDoxy commented Jun 1, 2017

I was stuck on the same issue for many days.
Either 'npm' nor 'ng' commands were recognized within Spring Tool Suite(Eclipse) but it was working in Windows (and Mac) terminals.
I updated the user and environment variables, reboot the IDE, but still it was not working.
But I have restarted the computer, and now Waaaaaouuh, it works fine.
So the best way to do is restart the computer just after installing NodeJs, so that changes can take effects globally.

Hope this comment will help.

@Shrutikarekal123
Copy link

Shrutikarekal123 commented Jun 21, 2017

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

untitled

@gautamjgithub
Copy link

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.

@PaulaOliveiraM
Copy link

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.

@dhanabalu
Copy link

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

@filipesilva
Copy link
Contributor

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.

@ghost
Copy link

ghost commented Jul 6, 2017

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

@raferbop
Copy link

raferbop commented Jul 7, 2017

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

@naru6be
Copy link

naru6be commented Jul 22, 2017

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

@dhaniksahni
Copy link

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.

@ubgen
Copy link

ubgen commented Nov 28, 2017

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

@Pushp1992
Copy link

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.

@SatishMHiremath
Copy link

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

@anamarquezz
Copy link

(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

@gjgiraldo
Copy link

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 !

@mahmoudelkhadragy
Copy link

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

@srigowrideo
Copy link

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?

@Pushp1992
Copy link

Pushp1992 commented Dec 1, 2018 via email

@srigowrideo
Copy link

srigowrideo commented Dec 1, 2018 via email

@Pushp1992
Copy link

Pushp1992 commented Dec 1, 2018 via email

@srigowrideo
Copy link

srigowrideo commented Dec 1, 2018 via email

@srigowrideo
Copy link

srigowrideo commented Dec 1, 2018 via email

@Pushp1992
Copy link

Pushp1992 commented Dec 1, 2018 via email

@srigowrideo
Copy link

srigowrideo commented Dec 1, 2018 via email

@srigowrideo
Copy link

srigowrideo commented Dec 1, 2018 via email

@Pushp1992
Copy link

Pushp1992 commented Dec 2, 2018 via email

@srigowrideo
Copy link

srigowrideo commented Dec 2, 2018 via email

@Pushp1992
Copy link

Pushp1992 commented Dec 2, 2018 via email

@srigowrideo
Copy link

srigowrideo commented Dec 2, 2018 via email

@MojtabaTaha
Copy link

hi i just have the same problem of ng is not recognized as an internal or external command. how can i fix it please

@srigowrideo
Copy link

srigowrideo commented Dec 20, 2018 via email

@CODevOp
Copy link

CODevOp commented Apr 7, 2019

I was getting this error, The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program.
The Fix for me was to uninstall node from appwiz.cpl and reinstall.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: more info Reporter must clarify the issue
Projects
None yet
Development

No branches or pull requests