Twilio Flex UI是否支持Node.js 18与NPM 8?插件启动报错求助
Twilio Flex UI Node.js/NPM Version Support & ERR_OSSL_EVP_UNSUPPORTED Fix
First, Twilio Flex UI v2 does support Node.js 18.x and NPM 8.x. The error you're seeing is not a core version compatibility issue with Flex itself, but a conflict between Node.js 18's default OpenSSL 3.0 settings and the older webpack version bundled with the Twilio CLI plugin tooling.
Root Cause
Node.js 18 switched to OpenSSL 3.0, which removes support for some legacy hash algorithms. The webpack version used by the Twilio CLI relies on one of these unsupported algorithms, triggering the ERR_OSSL_EVP_UNSUPPORTED error.
Fixes
1. Temporary Fix: Run Dev Server with Legacy OpenSSL Flag
Add the --openssl-legacy-provider flag via environment variables when starting the server:
- macOS/Linux:
NODE_OPTIONS=--openssl-legacy-provider twilio flex:plugins:start - Windows (Command Prompt):
set NODE_OPTIONS=--openssl-legacy-provider && twilio flex:plugins:start - Windows (PowerShell):
$env:NODE_OPTIONS="--openssl-legacy-provider"; twilio flex:plugins:start
2. Permanent Fix: Update Package.json Script
Modify the start script in your plugin's package.json to include the flag by default:
- For macOS/Linux:
"scripts": { "start": "NODE_OPTIONS=--openssl-legacy-provider twilio flex:plugins:start" } - For Windows:
"scripts": { "start": "set NODE_OPTIONS=--openssl-legacy-provider && twilio flex:plugins:start" }
3. For Publishing
If you hit the same error during build/publish, apply the flag to the build command:
NODE_OPTIONS=--openssl-legacy-provider twilio flex:plugins:build
Notes on Older Node Versions
Your inconsistent success with Node.js 16/14 was likely due to environment quirks. Downgrading is unnecessary—using the legacy OpenSSL flag with Node.js 18 is the stable, recommended solution.
内容的提问来源于stack exchange,提问作者Josiah

