Skip to content

Instantly share code, notes, and snippets.

@DevEarley
Last active July 1, 2019 15:13
Show Gist options
  • Save DevEarley/647ef4b4e5b67cf15a951527d1f68e1b to your computer and use it in GitHub Desktop.
Save DevEarley/647ef4b4e5b67cf15a951527d1f68e1b to your computer and use it in GitHub Desktop.
Running Specific version of Angular/CLI locally (not globally)

Why would you need this? Perhaps you need to build libraries for an old app. This way you can get all of the correct packages (and their peer dependencies) without installing an old version of the CLI globally.

First delete the global version of Angular CLI (this step sucks, I know...)

npm uninstall -g @angular/cli

Next use NPX to run any version of the CLI that you need. In this case, version 6.0.1 (Angular v6 has an issue with RXJS, you will need to change the rxjs version from "^6.0.0" to "6.0.0" in packages.json and reinstall it with npm.)

npx -p @angular/[email protected] ng new hello-world

Create a Component:

cd hello-world
npx ng generate component my-component

And build.

npx ng build

Credit to Viacheslav Starikov - I am using his example with the addition of the version tag. https://medium.com/@starikovs/how-to-use-angular-cli-locally-729dbb6707dd

@DevEarley
Copy link
Author

If you need to use angular 6.0.1 for whatever reason - make sure to change the rxjs reference from "rxjs": "^6.0.0" to "rxjs": "6.0.0"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment