How to use Angular CLI without global installation
I'm a developer using mostly angular.js. My angular2+ experience is mostly some studying or courses from time to time. Therefore - I'm not using angular-cli on a daily basis, and I seems to upgrade node & npm more often I generate a new angular2+ project.
The official doc, tells me to do as follow:
$ npm install -g @angular/cli $ ng new my-project
I'm a bit bothered by this, because:
- I'm not going to use that much before switching to the newer npm version
- I don't want to thing about any possible ways global version of angular cli would collide with local versions installed in projects
Besides, I really like the light-weight approach frameworks like Next.js or NuxtJS are allowing you to just start playing with their code generator.
Luckily, there is this alternative way of generating angular project:
$ npx -p @angular/cli ng new my-project
it does the job:
Even though angular documentation seems to assume you have no reason of trying out their framework, unless you it's your job and you need all the tooling all the time (maybe they are right about it); here we have an easier way of running their generator command, without turning our environment into angular-shop.