today, when building the Angular CLI framework, I encountered a strange problem. When I finished Angular CLI setup, I typed the ng
command on Windows PowerShell and command prompt, which worked fine, but failed on VSCode PowerShell.
I’ve sorted out the solutions here, hoping to be of some help to those reading this article.
problem description
The following error occurred when I typed the ng
command on VSCode PowerShell.
Program 'ng' failed to run: No application is associated with the specified file for this operationAt line:1 char:1
ng
~~.
At line:1 char:1
ng
~~
CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
FullyQualifiedErrorId : NativeCommandFailed
solution
change PowerShell execution policy on a Windows machine. Here are the steps:
get the list of execution policies
enter the following command to get a list of PowerShell execution policies:
Get-ExecutionPolicy -List
set CurrentUser policy
set CurrentUser to the remoteswignet strategy and enter the command ‘
‘
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
after the above steps are completed, close the VSCode PowerShell, and then restart it. Finally, re-enter the ng
command to check if it was successful.
-
if errors still occur, you can try to close all existing command prompt and PowerShell Windows.
-
try to restart your computer if you still have problems.
-
if the problem still exists, please check whether the
C:\Users\{username}\AppData\ NPM
environment variable is set. -
finally, you can also try reinstalling Angular CLI.
try it all over again anyway to make sure it works.
Read More:
- When angular4.0 starts the project, an error is reported: the “@ angular / compiler cli” package was not properly installed
- Solve angular’s cannot find module ‘@ angular devkit / core’ problem
- Solution to prompt run time error “438” when a VB program is opened
- How to make eclipse after the program is modified, click run to automatically save it.
- 2021 / 06 / 28 error – because the script PowerShell is not allowed to run on this system
- Python program uses OS. System () method to call exe program, resulting in no response of main program process
- Cannot run program “cd“: error=2, No such file or directory
- The problem of window flash after C + + program is compiled and run
- Unable to load file D:: program files (x86) node-v16.4.0-win-x861 because scripts are not allowed to run on this system.
- Angular Error You seem to not be depending on “@angular/core“ and/or “rxjs“. (Fixed)
- Cannot run program “make” when compiling APM firmware with eclipse under Windows: launching failed problem
- ERROR 11668 — [ restartedMain] o.s.boot.SpringApplication : Application run failed
- Genymotion runs the arm program, install failed no matching ABIS failed to extract native libraries res = – 113
- [OpenGL] cannot start this program because the computer is missing glut32.dll. Try to re install the program to fix this problem. …
- How to run Python program directly with atom
- Failed to add /run/systemd/ask-password to directory watch: No space left on device?
- ImportError: ‘DLL load failed: %1 is not a valid Win32 application.
- Using DOS command to run Java program
- This program cannot be started because vcruntime140 is missing from your computer_ 1.dll。 Try to install the program again to solve the problem.
- Raspberry pie set up to run Python program automatically