Node.js 17.0.1 Gatsby 오류 - "디지털 봉투 루틴:: 지원되지 않음...ERR_OSSL_EVP_지원되지 않음"
나는 개츠비 사이트를 만들고 있습니다.Node.js를 v17.0.1로 업그레이드했는데 빌드를 실행할 때 다음 오류가 발생합니다.
Error: digital envelope routines::unsupported
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
v16으로 다운그레이드하면 정상적으로 작동하고 빌드가 성공할 것입니다.이걸 어떻게 고칠 수 있을까요?
구글링에서도 비슷한 문제가 있을 수 있습니다.오류: 오류: 06065064: 디지털 엔벨로프 루틴:EVP_DecryptFinal_ex: 잘못된 암호 해독 #48
이게 도움이 될 수도 있어요이러한 스크립트를 패키지에 추가합니다.json 파일.
대응:
"scripts": {
"start": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
"build": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build"
}
사용 중인 경우Windows
그리고 당신은 사용하고 있습니다.React.js
사용할 수 있습니다.set
에 export
다음과 같이 스크립트에 표시됩니다.
"scripts": {
"start": "set SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
"build": "set SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build"
}
또는
"scripts": {
"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts --openssl-legacy-provider build",
}
Vue.js:
"scripts": {
"serve": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
"lint": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service lint"
},
사용 중인 경우Windows
그리고 당신은 사용하고 있습니다.Vue.js
사용할 수 있습니다.set
에 export
다음과 같이 스크립트에 표시됩니다.
"scripts": {
"serve": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
"lint": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service lint"
},
또는
"scripts": {
"serve": "vue-cli-service --openssl-legacy-provider serve",
"build": "vue-cli-service --openssl-legacy-provider build",
"lint": "vue-cli-service --openssl-legacy-provider lint"
},
각도:
"scripts": {
"start": "set NODE_OPTIONS=--openssl-legacy-provider && gulp buildDev && ng serve ",
"publish": "set NODE_OPTIONS=--openssl-legacy-provider && gulp build && ng build --prod",
},
빠른 수정: React 프로젝트 내의 터미널에서 실행합니다.
export NODE_OPTIONS=--openssl-legacy-provider
UPDATE ️
이것은 웹 팩 문제입니다(가능성이 가장 높음).
이후 버전 5.61.0에서 수정 사항을 릴리스했으므로 웹 팩을 버전 5.61.0 이상으로 업그레이드하면 이 문제도 해결될 것입니다.
웹 팩 팀의 한 직원이 수정 사항을 웹 팩 4로 백포트할 계획이 없다고 말했으므로, 웹 팩 4에 있는 경우에는 먼저 웹 팩 5로 업그레이드해야 할 수도 있습니다.
하는 웹팩과 관련이 있습니다.md4
해시와 그들의 해결책은 WASM 구현을 사용하는 것으로 전환하는 것이었습니다.md4
노드가 기본으로 제공되는 알고리즘이 아니라 알고리즘입니다(그 중 OpenSSL에 의존하는 노드는 OpenSSL이므로 오류).
원래 응답:
Gatsby / Gatsby에서 사용되는 도구는 OpenSSL 3.0에서 기본적으로 더 이상 허용되지 않는 암호화 알고리즘 또는 키 크기를 사용해야 합니다.
만약 당신이 그것은
ERR_OSSL_EVP_UNSUPPORTED
Node.js 17을 사용하는 응용 프로그램에서 오류가 발생했습니다. 응용 프로그램이나 사용 중인 모듈이 OpenSSL 3.0에서 더 이상 기본적으로 허용되지 않는 알고리즘이나 키 크기를 사용하려고 시도하고 있을 수 있습니다.새 명령줄 옵션,--openssl-legacy-provider
이와 같이 강화된 제한 사항에 대한 임시 해결 방법으로 레거시 공급자에게 되돌리기 위해 가 추가되었습니다.
터미널에서 이를 실행하는 방법은 다음과 같습니다.
node --openssl-legacy-provider ./node_modules/.bin/gatsby build
NODE_OPTIONS 환경 변수를 통해 이 정보를 전달할 수도 있습니다.
따라서 NPM 스크립트를 계속 사용하려면 다음을 변경할 수 있습니다.build
스크립트 대상:
// package.json
{
"scripts": {
"build": "export NODE_OPTIONS=--openssl-legacy-provider; gatsby build"
}
}
이 문제는 Node.js 17의 새 업데이트와 함께 제공됩니다.대응에서 패키지의 스크립트 특성을 변경할 수 있습니다.json 파일 대상:
"scripts": {
"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts --openssl-legacy-provider build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
저도 같은 문제가 있어서 Node.js 버전을 다운그레이드했습니다.
Node.js 제거
그런 다음 16.13.0을 다운로드하여 설치합니다.
새로운 Node.js 업데이트 후 발생한 이 오류에 대한 해결책은 두 가지가 있다고 생각합니다.
Node.js 다운그레이드
node_codice_codice_codice_codice_codice_config\webpack.config.js - 여기에 있는 .js 파일 안에 이 코드를 추가해야 합니다.
const crypto = require("crypto"); const crypto_orig_createHash = crypto.createHash; crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);
Vue.js 3 및 Node.js v17.0.1에 대한 빌드 명령으로 사용합니다.
cross-env NODE_OPTIONS='--openssl-legacy-provider' vue-cli-service build"
Rajiv의 접근 방식은 해결책으로 옳은 것 같지만 Vue.js에서는 구문이 작동하지 않았습니다."SET"라는 키워드 없이 작동했습니다.
"scripts": {
"serve": "NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build": "NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
"test:unit": "NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service test:unit",
"lint": "NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service lint"
},
제어판을 통해 Node.js 버전 17.0.1을 제거했습니다.
그런 다음 nodejs.org 에서 Node.js 버전 16.13.1을 다운로드하여 설치하면 React Native가 시작되고 올바르게 빌드됩니다.
이와 유사한 문제가 버전 17.3.0에서 발생했습니다.
- Node.js를 제거하고 버전 16.13.0을 설치한 후 다시 시작했습니다.
- 새로운 터미널에서 실행함으로써, 그것은 고쳐졌습니다.
저는 서버의 Angular 애플리케이션과 같은 문제에 직면했습니다.
자세한 내용은 Node.js의 최신 릴리스 설명서에서 확인할 수 있습니다.
패치 적용 중--openssl-legacy-provider
해킹에 더 가까우며 진정한 해결책은 오픈을 고치는 것입니다.Vue.js, React 등에서의 SSL 키 크기 사용. 시간적 해결 방법은 실제로 이전 버전의 Node.js를 사용할 수 있습니다.
그러나 Node.js를 다운그레이드하지 말고 NVM(메인/윈: nvm-windows/nodist/nvs, 마지막 버전은 크로스 플랫폼)을 설치하고 필요에 따라 버전 간에 전환하는 것이 좋습니다.
Node.js를 다운그레이드하거나 nvm을 사용하여 Node.js 버전을 전환해야 합니다.저는 이것을 했고 리액트는 잘 작동했습니다.
언급URL : https://stackoverflow.com/questions/69665222/node-js-17-0-1-gatsby-error-digital-envelope-routinesunsupported-err-os
'programing' 카테고리의 다른 글
자동 배선 환경이 null입니다. (0) | 2023.08.30 |
---|---|
MySQL Ubuntu 14.04 LTS 완전히 제거 (0) | 2023.08.30 |
괜찮은 투명한 아약스 스피너를 어디서 찾을 수 있습니까? (0) | 2023.08.30 |
요구 사항을 가져오는 방법.Poetry를 사용하는 기존 프로젝트의 txt (0) | 2023.08.30 |
CSS 그리드의 동일한 너비 열 (0) | 2023.08.30 |