How to use Angular CLI locally
1 min readMay 12, 2018
Here I’m going to share with you an approach of how to use Angular CLI locally without having the global installation of it. I’ve been using this way of utilizing the CLI for some time and I really love it.
Step 1: Uninstall the global version of the CLI
npm uninstall -g @angular/cli
Step 2: Use npx
to create a new project
npx -p @angular/cli ng new hello-world-project
npx
will download the @angular/cli
package temporarily and run the ng
command. BTW, npx goes with the npm installation.
Step 3: Run the ng
command using the npx
as well
npx ng generate component my-component
So, here the npx
is smart enough again! It finds out that the ng
command exists locally in ./node_modules/.bin/
directory and runs it.
That’s it and happy coding!
Follow me on Medium or Twitter to read more about Angular, JS and startups!