node-sass 오류 해결 방법

Divide & Conquer·2022년 12월 18일
2

node

목록 보기
2/2

Transformer를 이용해 자연어처리 서비스를 구현해 보려고 python3을 깔고 이것 저것 해보다가, node기반으로 개발해 놓은 에디터의 수정사항이 생겨 yarn start를 하니 아래와 같은 오류가 발생

npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError 

여기 저기 오류 해결 방법을 찾아봤지만 딱히 나의 케이스와는 맞지 않았다.
https://www.inflearn.com/questions/31250/%EB%85%B8%EB%93%9C-api-%EC%84%9C%EB%B2%84-npm-install-%EC%8B%9C-%EB%B0%9C%EC%83%9D%ED%95%98%EB%8A%94-%EC%97%90%EB%9F%AC
https://ahntoday.tistory.com/205
https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=developer_life&logNo=221264871637

별에 별 짓을 다 해봤지만, 안 됨!!

결국 Nodejs를 새로운 버전으로 깔아 보기로 결심

  1. 18.12.1로 설치
  2. node-sass 제거
yarn add node-sass
  1. yarn install 실행
    => 또 오류 발생!!
ode:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (node_modules\webpack\lib\NormalModule.js:417:16)

이건 또 뭔 개소리야!!!!

OpenSSL v3.0 때문인거 같은데.... 다시 또 구글링...
https://bobbyhadz.com/blog/react-error-digital-envelope-routines-unsupported

  1. 속는셈치고 아래 명령어 입력
    cmd 창
set NODE_OPTIONS=--openssl-legacy-provider

powershell

$env:NODE_OPTIONS = "--openssl-legacy-provider"
  1. yarn install, yarn start 모두 성공

package.json 열어보니..
node-sass 4.14.1 => 8.0.0로 버전업 되버림...

profile
IT의 어려운 난제를 작은 단위로 분할하여 정복해 나간다.

0개의 댓글