fix: error:0308010C:digital envelope routines::unsupported (#1447)

* fix: error:0308010C:digital envelope routines::unsupported

* fix: process.env.UNSET_NODE_OPTIONS
This commit is contained in:
chenos 2023-02-10 11:16:36 +08:00 committed by GitHub
parent f8a11cbbf0
commit 2dc9c5c444
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

View File

@ -19,7 +19,7 @@ jobs:
sqlite-test:
strategy:
matrix:
node_version: ['16']
node_version: ['16', '18']
runs-on: ubuntu-latest
container: node:${{ matrix.node_version }}
steps:
@ -30,6 +30,7 @@ jobs:
node-version: ${{ matrix.node_version }}
cache: 'yarn'
- run: yarn install
- run: yarn build
- name: Test with Sqlite
run: yarn test
env:
@ -39,7 +40,7 @@ jobs:
postgres-test:
strategy:
matrix:
node_version: ['16']
node_version: ['16', '18']
runs-on: ubuntu-latest
container: node:${{ matrix.node_version }}
@ -66,6 +67,7 @@ jobs:
node-version: ${{ matrix.node_version }}
cache: 'yarn'
- run: yarn install
- run: yarn build
- name: Test with postgres
run: yarn test
env:
@ -79,7 +81,7 @@ jobs:
mysql-test:
strategy:
matrix:
node_version: ['16']
node_version: ['16', '18']
runs-on: ubuntu-latest
container: node:${{ matrix.node_version }}
services:
@ -97,6 +99,7 @@ jobs:
node-version: ${{ matrix.node_version }}
cache: 'yarn'
- run: yarn install
- run: yarn build
- name: Test with MySQL
run: yarn test
env:

View File

@ -35,6 +35,21 @@ for (const key in env) {
}
}
if (require('semver').satisfies(process.version, '>16') && !process.env.UNSET_NODE_OPTIONS) {
if (process.env.NODE_OPTIONS) {
let opts = process.env.NODE_OPTIONS;
if (!opts.includes('--openssl-legacy-provider')) {
opts = opts + ' --openssl-legacy-provider';
}
if (!opts.includes('--no-experimental-fetch')) {
opts = opts + ' --no-experimental-fetch';
}
process.env.NODE_OPTIONS = opts;
} else {
process.env.NODE_OPTIONS = '--openssl-legacy-provider --no-experimental-fetch';
}
}
const cli = require('../src/cli');
cli.parse(process.argv);