How to Update Ember & Ember CLI

Last reviewed in June 2019 with Ember Octane

Upgrading Ember is easier than ever with the great ember-cli-update.

Install it:

$ npm i -g ember-cli-update   # or yarn global add ember-cli-update

The command to update to the latest version of Ember is simply:

$ ember-cli-update
Note that you must run this command on a clean git branch!

Once it's done, you will have the chance to review changes and resolve any merge conflicts.

diagram

Finally, install the new dependencies:

$ npm install

Bigger updates

If you don't want to update to the latest, you can use:

$ ember-cli-update --to 3.1.0

This can be very useful when doing bigger updates. Edward Faulkner has said:

If you have a long upgrade to make (say, from 2.6 to 3.1), the easiest solution is to do it by stepping from LTS release to LTS release, clearing deprecations as you go. This strategy works because those upgrade paths tend to be well-tested ones by lots of other people before you, and also because we try hard not to break even private APIs that we know are used by popular addons without first showing a deprecation warning through an LTS cycle.

Codemods

Another cool feature of ember-cli-update is the ability to run codemods. For example, automatically porting old syntax to the new testing API.

$ ember-cli-update --run-codemods

Double-checking and booting the server

A quick version check will tell us if this went alright:

$ ember -v
ember-cli: 3.11.0-beta.3
node: 8.11.1
os: darwin x64

Further, launching the app we can verify our Ember and Ember Data versions are properly set up:

$ ember s
Build successful (3698ms) – Serving on http://localhost:4200/

Proof:

diagram

Ember is now up-to-date!

Enjoyed this article? Join Snacks!

Snacks is the best of Ember Octane in a highly digestible monthly newsletter. (No spam. EVER.)