Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I properly configure ng from npm as a normal CLI command?

I am seeing tutorials with NPM and Node.js that have the ng package handler. However, they run this straight from the command prompt. I am curious if I am missing something to install to run commands like ng serve for example, without having to preface them with npm run like npm run ng serve --open ?

Thank you!

like image 784
dmanexe Avatar asked Dec 02 '25 09:12

dmanexe


1 Answers

You don't naturally prefix the ng server with npm run

Install the angular-cli globally

npm i -g @angular/cli

Then you will be able to do:

ng serve
ng new [appname]
ng generate component [name] 

Without any prefix and from anywhere.

like image 52
Aritra Chakraborty Avatar answered Dec 05 '25 01:12

Aritra Chakraborty