Angular-cli: 'ng' is not recognized as an internal or external command, operable program or batch file.

Created on 5 Feb 2017  路  24Comments  路  Source: angular/angular-cli

Am getting this at after setup

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

C:UsersUSER>node --version
v6.9.5

Am using Windows 10/ 64 bit

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

The log given by the failure.

Normally this include a stack trace and some more information.

Mention any other details that might be useful.


Thanks! We'll be in touch soon.

Most helpful comment

I just got a new computer (win 10) and experienced the same problem moving to new environment. I added %APPDATA%npm to the PATH environment variable. That is where the ng command is (thanks emrhzc).

All 24 comments

Either you haven't installed the CLI globally or you haven't added your NPM home dir to your PATH?

image

Please, how do i add NPM home dir to my path?

http://stackoverflow.com/questions/27864040/fixing-npm-path-in-windows-8 might help?

Have a look at Yar's answer for finding the npm path. The other answers for how to add that path to your Windows PATH environment variable.

The problem is NOT the install of the NPM nor the path !
If you want to use the "ng" commend you need to install the angular-cli.

https://cli.angular.io/

like @eran12 said it doesn't look like you have @angular/cli installed. verify that the installation was completed successfully.

Thanks everyone i think i found a way around this

@LunaBawa Would you share please?

Would you please share?

yep! share is good!

I believe his solution is to install @angular/cli

this documentation would help : Angular CLI Quickstart

have the same problem after installing cli globally; "npm install -g @angular/cli"
npm is working fine, suggesting it is among path variables.
@LunaBawa, would you mind sharing your solution?

note: in my case the problem was that the above command for global cli installation puts ng into
C:UsersuserAppDataRoamingnpm,
though it should see the installation as npm pointed in the build path;
C:Program Filesnodejsnode_modulesnpm
Adding the location in AppData into build variables solved the problem.

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:UsersDellAppDataRoamingnpmnode_modules@angular

Then try ng help. It will work.

it doesn't do for me. any other suggestions?

I am having the same issue, and I am using Windows 7 home premium.

Hi Friends!
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

I just got a new computer (win 10) and experienced the same problem moving to new environment. I added %APPDATA%npm to the PATH environment variable. That is where the ng command is (thanks emrhzc).

emrhzc's solution worked, thank you!

thanks emrhzc銆侷 met the same problem and now I've solved it.

I tried to install via npm and the following error given by the terminal

位 npm install -g @angular/cli
npm ERR! Unexpected end of JSON input while parsing near '...erify":"latest","@typ'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Priya Ranjan Dubey\AppData\Roaming\npm-cache\_logs\2018-09-17T10_54_38_949Z-debug.log

the angular-cli was installed using yarn but after running ng --version ng was not recognized

位 ng --version
'ng' is not recognized as an internal or external command,
operable program or batch file.

What to do?

Hey Techie: It seem you are on a windows computer. Verify that CLI is installed:

> CD %APPDATA%\npm
> ng --version

If installed configure your local PATH to include the above folder.

Hi I have face this error while am trying to create new app using ng new -Myapp syntax.
and i have already installed latest version of npm cli.

Still i getting following error.
Error:
'ng' : The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1

  • ng --version
  • ~~

    • CategoryInfo : ObjectNotFound: (ng:String) [], CommandNotFoundException

    • FullyQualifiedErrorId : CommandNotFoundException

Please try to use Node.js command prompt in your windows. It will work.

The problem is NOT the install of the NPM nor the path !
If you want to use the "ng" commend you need to install the angular-cli.

https://cli.angular.io/

I installed the angular cli as well and also added the environment variables, but still getting the error.

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