NodeJS --harmony flag explained

A brief tutorial explaining the use of --harmony flag

Posted on June 20, 2021


Sometimes, you may encounter a NodeJS application that uses the --harmony flag when starting the application.

The shell command may be as follows:

node --harmony index.js

The --harmony flag allows you to use ECMAScript 6 (ES6) features that are marked as staged.

A staged feature is a completed feature that’s not yet considered stable and may have breaking changes when it reaches the shipping status.

You can find more information from NodeJS documentation page.

Today, the latest NodeJS versions already supported ES6 features, so there’s no need for the --harmony flag anymore.

If you find your application can’t run without the --harmony flag, you may need to update your NodeJS version to the latest stable version.

Keep in mind that you may have breaking changes if your current NodeJS version hasn’t been updated for more than a year. Make sure that you test your code thoroughly after updating before deploying to production.

Related articles:

Level up your programming skills

I'm sending out an email once every Wednesday with the latest programming tutorials. Drop your email in the box below and I'll send new stuff straight into your inbox!

No spam. Unsubscribe anytime.