Skip to content

Commit 8d8c5de

Browse files
RPGillespie6filipesilva
authored andcommitted
docs(@angular/cli): Update 1.0 upgrade guide (#5876)
Added a few extra details on how to remove residual versions of Angular CLI and reorganized upgrade steps. Fixes #5842
1 parent 380ec59 commit 8d8c5de

File tree

1 file changed

+41
-15
lines changed

1 file changed

+41
-15
lines changed

docs/documentation/stories/1.0-update.md

+41-15
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,58 @@ If you prefer, you can also generate a new project in a separate folder using
2323

2424
## @angular/cli
2525

26-
Angular CLI can now be found on NPM under `@angular/cli` instead of `angular-cli`, and has a
27-
minimum requirement of Node 6.9.0 or higher, together with NPM 3 or higher.
26+
Angular CLI can now be found on NPM under `@angular/cli` instead of `angular-cli`, and upgrading is a simple 3 step process:
2827

29-
If you're using Angular CLI `beta.28` or less, you need to uninstall the `angular-cli` package.
28+
1. Uninstall old version
29+
2. Update node/npm if necessary
30+
3. Install new version
31+
32+
### 1. Uninstall old version
33+
34+
If you're using Angular CLI `beta.28` or less, you need to uninstall the `angular-cli` packages:
3035
```bash
31-
npm uninstall -g angular-cli
32-
npm uninstall --save-dev angular-cli
36+
npm uninstall -g angular-cli # Remove global package
37+
npm uninstall --save-dev angular-cli # Remove from package.json
3338
```
3439

35-
To update Angular CLI to a new version, you must update both the global package and your project's
36-
local package.
37-
38-
Global package:
40+
Otherwise, uninstall the `@angular/cli` packages:
3941
```bash
40-
npm uninstall -g @angular/cli
42+
npm uninstall -g @angular/cli # Remove global package
43+
npm uninstall --save-dev @angular/cli # Remove from package.json
44+
```
45+
46+
Also purge the cache and local packages:
47+
```
48+
rm -rf node_modules dist # Use rmdir on Windows
4149
npm cache clean
42-
npm install -g @angular/cli@latest
4350
```
4451

45-
Local project package:
52+
At this point, you should not have Angular CLI on your system anymore. If invoking Angular CLI at the commandline reveals that it still exists on your system, you will have to manually remove it. See _Manually removing residual Angular CLI_.
53+
54+
### 2. Update node/npm if necessary
55+
56+
Angular CLI now has a minimum requirement of Node 6.9.0 or higher, together with NPM 3 or higher.
57+
58+
If your Node or NPM versions do not meet these requirements, please refer to [the documentation](https://docs.npmjs.com/getting-started/installing-node) on how to upgrade.
59+
60+
### 3. Install the new version
61+
62+
To update Angular CLI to a new version, you must update both the global package and your project's local package:
63+
4664
```bash
47-
rm -rf node_modules dist # use rmdir on Windows
48-
npm install --save-dev @angular/cli@latest
49-
npm install
65+
npm install -g @angular/cli@latest # Global package
66+
npm install --save-dev @angular/cli@latest # Local package
67+
npm install # Restore removed dependencies
5068
```
5169

70+
### Manually removing residual Angular CLI
71+
72+
If you accidentally updated NPM before removing the old Angular CLI, you may find that uninstalling the package using `npm uninstall` is proving fruitless. This _could_ be because the global install (and uninstall) path changed between versions of npm from `/usr/local/lib` to `/usr/lib`, and hence, no longer searches through the old directory. In this case you'll have to remove it manually:
73+
74+
`rm -rf /usr/local/lib/node_modules/@angular/cli`
75+
76+
If the old Angular CLI package _still_ persists, you'll need to research how to remove it before proceeding with the upgrade.
77+
5278
## .angular-cli.json
5379

5480
`angular-cli.json` is now `.angular-cli.json`, but we still accept the old config file name.

0 commit comments

Comments
 (0)