node버전을 14.21.3 ⇒ 18.17.0 으로 변경 후 npm run serve 실행하면 나타나는 오류

opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'

해결 방법:

  1. Node.js 버전 확인:

이후 다시 npm run serve 실행 시 나타나는 오류

ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"^6.8.0" from the root project
npm ERR!   peer eslint@">=6.2.2" from @vue/[email protected]
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!     dev @vue/eslint-config-standard@"^5.1.2" from the root project
npm ERR!   2 more (eslint-plugin-import, eslint-plugin-node)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^7.0.0 || ^8.0.0 || ^9.0.0" from [email protected]
npm ERR! node_modules/eslint-plugin-promise
npm ERR!   peer eslint-plugin-promise@">= 4.2.1" from @vue/[email protected]
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!     dev @vue/eslint-config-standard@"^5.1.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/jiun/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jiun/.npm/_logs/2024-10-15T00_21_16_774Z-debug-0.log

해결 방법:

  1. -force 또는 -legacy-peer-deps 옵션 사용:

    npm install --force
    

    또는

    npm install --legacy-peer-deps
    
    
  2. 의존성 버전 확인 및 수동 수정:

    충돌 패키지 이름과 버전 정보를 확인하려면 다음 명령을 사용할 수 있습니다:

    npm ls <패키지명>
    npm update <패키지명>
    

    그런 다음, 의존성 버전을 수정한 후 다시 npm install을 시도하세요.

  3. 패키지 잠금 파일 삭제 후 다시 설치: (사용한 방법)

    rm -rf node_modules package-lock.json
    npm install
    

    또는 yarn을 사용하는 경우:

    rm -rf node_modules yarn.lock
    yarn install
    
  4. npm 최신 버전으로 업데이트:

    npm install -g npm