Program ng failed to run No application is associated with the specified file
Issue Description
Ng commands on Visual Studio code gives below error,
Program 'ng' failed to run No application is associated with the specified file for this operation line
Resolution
I had this issue recently upgrading to the Angular CLI framework.
Ng Commands were working fine in other CLI as PowerShell and commands prompt but was failing on the VSCode PowerShell.
Steps to resolve the issue
To change the PowerShell execution policy on your Windows computer, use the below command
Step1: Get-ExecutionPolicy for your Machine using the below command
Get-ExecutionPolicy -List
Step2: please run the below commands
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Please close the VSCode PowerShell and restart it. Finally, you shall be all set to run your script. If any issue persists, just restart your machine.
If you still get any errors, please make sure to close all existing commands prompt / PS windows.
If the issue still persists please make sure you have set the Environment variable properly as explained here. You can also try re-installing Angular cli.
Additional references:
That’s all! Happy coding!
Does this help you fix your issue?
Do you have any better solutions or suggestions? Please sound off your comments below.
Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.
I see the error when i try to execute php code on visual studio. please help
No, It’s still not working.
Hi Roopesh- Please make sure to close all command prompt or PowerShell. If the issue still persists please refer this article
No I tried after executing the above still it is not working
Thank you it worked !!!
Thanks, Balkrishna. Glat it helped you! Have a good day!