1

I have successfully installed node 8.11.1 and npm 5.6.0 After that I have installed angular CLI also as below

npm install -g @angular/cli

When I am trying to create project using below command

ng new MyApp

I am getting error as "ng is not recognized as an internal or external command, operable program or batch file"

Please provide solution for the same if I am doing anythin wrong please let me know.

Complete details are showing in attached screen shot enter image description here

4
  • add your npm's global installation dir to the path
    – baao
    Commented May 5, 2018 at 8:31
  • Possible duplicate of 'phonegap' is not recognized as an internal or external command
    – ariefbayu
    Commented May 5, 2018 at 8:32
  • Thanks Baao, I have added below directory to my user's path variable. and restarted system, but still getting same error. C:\Program Files\nodejs\node_modules\npm\bin Commented May 5, 2018 at 8:36
  • @GAJANANJADHAV Instead try to add this path as environment variable for ng - "C:\Users\YOUR_NAME\AppData\Roaming\npm" Commented May 5, 2018 at 10:20

2 Answers 2

1

You need to add that installation in your environment variable of your system. Since, you are using windows go to your environment variable ,

  1. From the desktop, right click the Computer icon.
  2. Choose Properties from the context menu.
  3. Click the Advanced system settings link.
  4. Click Environment Variables. If the PATH environment variable does not exist, click New and create one
  5. In the Edit Environment Variablewindow, specify the value of the PATH environment variable. Which should be C:\users\YOUR_USER\AppData\Roaming\npm\node_modules\@angular\cli\bin
  6. Click OK. Close all remaining windows by clicking OK.
  7. Reopen Command prompt window, and run ng new MyApp. It should work now.
1

ng is not recognized as an internal or external command, operable program or batch file

  • Many of us has face this error, while working with angular in windows system. So to solve this error just in command prompt/Power shell, u have to install the lower version of angular or the same version of angular as that of ur project of angular version.

    You have to run command npm i @angular/cli at C:\Users\Dell\AppData\roaming\npm> at this file path and all the error of ng will resolved

Not the answer you're looking for? Browse other questions tagged or ask your own question.