티스토리 뷰

개요

node v16을 지원하는 툴 (vercel) 들이 점점 deprecated 되는 과정에서 node v20으로 마이그레이션 하는 법을 알아보기로 하였다.

실제 유지보수 하는 서비스의 경우에도 마이그레이션 하는 일이 발생할 것 같아 진행해 보았다.

시나리오

  1. nvm을 사용해서 원하는 버전(20)으로 변경한다.
  2. yarn.lock을 삭제하고 .yarn/cache를 삭제한다.
  3. yarn 명령어를 실행하여 다시 의존성을 설치한다.

까지가 원래의 시나리오 였다.

문제 발생

yarn을 통해 의존성들을 설치하는 과정에서 failed가 발생하면서 다음과 같은 에러가 발생했다.

Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

무언가 경로를 인식하지 못하는 문제인 것 같아서 찾아보니 쉽게 해결방법을 찾을 수 있었다.

https://github.com/yarnpkg/berry/issues/5829

 

🐞 `yarn set version` on Node.js <18 · Issue #5829 · yarnpkg/berry

I open this thread to cover an issue we noticed regarding Yarn 3.x when used with versions of Node.js lower than 18. It's a little complex, so it's worth opening a thread outlining the problem and ...

github.com

 

yarn berry 버전 문제

현재 yarn berry를 3.0 버전을 사용중인데 nodejs 18버전 미만인 경우에는 사용할 수가 없다.

  1. node version을 16 그대로 둔다.
  2. yarn 4.0을 쓴다.

https://yarnpkg.com/blog/release/4.0

 

Release: Yarn 4.0 🪄⚗️ | Yarn

Today is the day! After more than a year of work, our team is excited to finally put a fancy "stable" sticker on the first release from the 4.x release line! To celebrate, let's make together a tour of the major changes; should you look for a more itemized

yarnpkg.com

위의 링크를 확인하면 18+ 부터 yarn 4.0버전을 쓰면 된다고 나와있다. 추가적인 설명도 있으니 관심있으면 읽어보면 좋겠다.

'사이드 프로젝트' 카테고리의 다른 글

nestjs serverless 배포하기  (1) 2024.01.30
코드 스플리팅과 Tree shaking  (1) 2023.12.06
Error handling 삽질하기  (2) 2023.12.04