Software⏱️ 3 min read📅 2026-06-04

How to Fix: Error message "node: --openssl-legacy-provider is not allowed in NODE_OPTIONS"

Error message when using Node.js with npm on Ubuntu 20.04 (Focal Fossa) after upgrade.

Quick Answer: Update npm configuration to use the new version of Node.js.

The error message 'node: --openssl-legacy-provider is not allowed in NODE_OPTIONS' appears after an update on Ubuntu 20.04 (Focal Fossa) and affects Node.js v18.4.0 users.

This issue can be frustrating for developers who rely on legacy OpenSSL providers, but there are steps to resolve the problem.

⚠️ Common Causes

  • The primary reason for this error is that Ubuntu 20.04 (Focal Fossa) has removed support for the --openssl-legacy-provider flag in Node.js by default.
  • This change was made as part of a security update and aims to improve the overall security posture of the system.

🔧 Proven Troubleshooting Steps

Enabling the --openssl-legacy-provider flag manually

  1. Step 1: Open the /etc/node.conf file in a text editor using sudo privileges (e.g., `sudo nano /etc/node.conf`).
  2. Step 2: Add the following line to the end of the file: `node_options=--openssl-legacy-provider`.
  3. Step 3: Save and close the file. The changes will take effect during the next Node.js restart.

Using a custom Node.js configuration

  1. Step 1: Create a new file in the /etc/node.conf.d/ directory (e.g., `sudo nano /etc/node.conf.d/custom_node_options.conf`).
  2. Step 2: Add the following line to the end of the file: `node_options=--openssl-legacy-provider`.
  3. Step 3: Save and close the file. This configuration will override the system-wide Node.js settings.

✨ Wrapping Up

By enabling the --openssl-legacy-provider flag manually or using a custom Node.js configuration, you can resolve the 'node: --openssl-legacy-provider is not allowed in NODE_OPTIONS' error on Ubuntu 20.04 (Focal Fossa) with Node.js v18.4.0.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions