'Laravel TALL npm run dev --openssl-legacy-provider is not allowed in NODE_OPTIONS

I have just updated the npm packages of my Laravel project right at my MacOS system (I have been developing on Laravel Homestead since so long but npm didn't work for me),

% npm list

% npm update -D

% npm list to compare the versions differences

% npm install

also brew update and brew upgrade (on MacOS).

So I got now the following versions:

% npm -v: 8.1.0

├── @fortawesome/[email protected]
├── @tailwindcss/[email protected]
├── @tailwindcss/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

When I run $ npm run dev nothing happens and I get the following message:

% npm run dev

> dev
> npm run development


> development
> mix

node: --openssl-legacy-provider is not allowed in NODE_OPTIONS

What do I do to fix it?

Workaround

I ran $ npm run dev right inside the Ubuntu Laravel Homestead and it worked! At the end I got the following messages:

webpack compiled successfully
npm notice
npm notice New major version of npm available! 7.12.1 -> 8.1.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.1.2
npm notice Run npm install -g [email protected] to update!
npm notice

But I won't update, since I'm afraid I'll get the same error.

Notice:

% => I am running on MacOS.

$ => I am running on Ubuntu.

Update

I have just updated again everything with

% brew update
% brew upgrade

Then I ran again

% npm run dev even if I still got npm -v => 8.1.0, but my packages have been updated:

├── @fortawesome/[email protected]
├── @tailwindcss/[email protected]
├── @tailwindcss/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

and it's working normally again!



Solution 1:[1]

For me the cause was node version 17.

I downgraded node to version 16 (LTS) and it worked.

See also the answer here https://stackoverflow.com/a/70286141/936284

Solution 2:[2]

unset NODE_OPTIONS

worked for me

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alexander Taubenkorb
Solution 2 Sourabh Das