Shraddha Gaikwad
Shraddha Gaikwad

Reputation: 41

how to run ng related commands as its showing error

ng --version

Program 'ng' failed to run: No application is associated with the specified file for this operation At line:1 char:1
    + ng --version
    + ~~~~~~~~~~~~.
    At line:1 char:1
    + ng --version
    + ~~~~~~~~~~~~
        + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
        + FullyQualifiedErrorId : NativeCommandFailed

I tried to install angular by running 'npm install -g @angular/cli' command. It installed properly but when I run ng command, it shows the above error.

Upvotes: 3

Views: 6424

Answers (3)

Vikram Sapate
Vikram Sapate

Reputation: 1317

Sometimes this error comes if you are using powershell in VSCode terminal. I just changed it to cmd promt and it worked for me.

Upvotes: 1

snehab
snehab

Reputation: 744

I faced a similar issue and I added the following path to my system variable path : C:\Users\AppData\Roaming\npm

Then I found ng command is working in my system command prompt but not in Visual Studio Code. Hence I followed the below steps:

  • For this click Ctrl+Shift+P and then select "Select Default Shell" option and choose Command prompt.
  • Now try running ng command in Visual Code it worked for me.

Upvotes: 4

Shubham Ghormade
Shubham Ghormade

Reputation: 197

Install node first - https://nodejs.org/en/ node -v TO CHECK NODE VERSION

Uninstall Angular

npm uninstall -g @angular/cli

npm cache clean

npm install -g @angular/cli@latest


ng -v TO CHECK CLI VERSION

Upvotes: 1

Related Questions