DEV Community

Marcin Wosinek
Marcin Wosinek

Posted on • Edited on

7 2

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


Enter fullscreen mode Exit fullscreen mode

I'm a bit bothered by this, because:

  1. I'm not going to use that much before switching to the newer npm version
  2. 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


Enter fullscreen mode Exit fullscreen mode

as you can see it here:

it does the job:

Alt Text

Summary

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.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay