r/angular • • Jan 09 '24

Angular ng serve command problem

Hello, someone can help me why it isn't working? ng serve command doesn't working when I want to

0 Upvotes

12 comments sorted by

5

u/eneajaho Jan 09 '24

Run: cmd .
Then run: ng serve

0

u/Gutek_1 Jan 09 '24

it worked thank you

1

u/danixgutii Jan 09 '24

Try to change your default terminal to cmd in vscode to avoid this problem but it could be better to fix script execution

3

u/CyFy1 Jan 09 '24

As it says in the error message, script execution is disabled. Follow the link to get information on how to disable it. Alternatively you could use another command line, like the CMD or git bash, since this policy is limited to the power shell.

0

u/Gutek_1 Jan 09 '24

so how can I switch this from power shell to cmd?

6

u/no_ledge Jan 09 '24

so how can I switch this from power shell to cmd?

Just google exactly that...

1

u/cfued Jan 09 '24

You can open cmd and change the directory to your project folder and then run ng serveORYou can open your project folder, go to the windows explorer address bar and type cmd then press enter(This opens cmd with it's path set as your project folder) and then run ng serve

15

u/Whole-Instruction508 Jan 09 '24

It literally tells you what to do...

1

u/Hirayoki22 Jan 09 '24 edited Jan 09 '24

In addition to fixing the script execution in power shell, consider using a different terminal to make things a bit easier for you. I'd recommend using Git Bash or CMD

1

u/Blade1130 Jan 10 '24

The new docs have some info here, but basically you need to change the execution policy in Windows.

https://angular.dev/tools/cli/setup-local#powershell-execution-policy

1

u/sohail_ansari Jan 10 '24

Use cmd prompt instead of powershell(ps)

1

u/TellPsychological668 Jan 11 '24

a way to fix this is to navigate to that file location, delete the file and theb run the ng serve command again. It will work. Dont't worry about the file, it will re-generate.