Ошибка «CERT_HAS_EXPIRED» в Node JS
Ошибка:
Could not resolve checkpoint: { Error: certificate has expired
at extractValue (...\node_modules\sync-rpc\lib\index.js:165:19)
at ...\node_modules\sync-rpc\lib\index.js:175:12
at request (...\node_modules\sync-request\lib\index.js:28:15)
at Bluebird.try (...\script.js:136:25) code: 'CERT_HAS_EXPIRED' } Error: certificate has expired
at extractValue (...\node_modules\sync-rpc\lib\index.js:165:19)
at ...\node_modules\sync-rpc\lib\index.js:175:12
at request (...\node_modules\sync-request\lib\index.js:28:15)
at Bluebird.try (...\script.js:136:25)
Решение:
В самое начало скрипта до подгрузки request библиотеки добавить строку:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
к примеру:
...
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
...
const requestSync = require('sync-request');
...