chore: specify node.js version
Description
Closes #262
pnpm의 Node.js 자동 설치 기능을 활용합니다. Global하게 설치하는 방법도 고민했지만 환경에 따라 원활하게 설치되지 않는 문제가 있어 pnpm으로 정했습니다.
Before submitting the PR, please make sure you do the following
- [x] Read the Contributing Guidelines
- [x] Read the Contributing Guidelines and follow the Commit Convention
- [x] Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g.
fixes #123). - [ ] Ideally, include relevant tests that fail without this PR but pass with it.
docker를 사용하는데도 환경에 따라 원활하게 설치되지 않을 수 있나요?? global하게 설치하는 방법을 하나 찾아서 공유드립니다(여기)
docker를 사용하는데도 환경에 따라 원활하게 설치되지 않을 수 있나요?? global하게 설치하는 방법을 하나 찾아서 공유드립니다(여기)
@SH9480P 이 커밋에서 시도해봤는데, 이유는 모르겠는데 devcontainer에서는 제대로 동작을 안하더라고요...
$ pnpm env use --global 16
Node.js 16.19.0 is activated
/home/node/.local/share/pnpm/node -> /home/node/.local/share/pnpm/nodejs/16.19.0/bin/node
$ node -v
v18.12.1
$ pnpm node -v
v18.11.0
.nvmrc 사용하니까 devcontainer에서는 global하게 설치 잘 되는데, GitPod에서는 해결책을 못 찾겠네요...
구글링 해보니까 Dockerfile 쓰라는 답 밖에 못 찾았는데, Dockerfile에서는 .nvmrc 파일을 불러올 수 없으니까 우리는 쓸 수 없어요.
https://github.com/gitpod-io/gitpod/issues/7459#issuecomment-1006096025
GitPod에서 어떻게 안 되는지 설명을 덧붙이면, workspace 실행하고 처음 초기화하는 command에서는 잘 되는데, 터미널을 새로 열었을 때에는 적용이 안돼요. 아래처럼 처음에는 node 버전이 18.x.x로 잘 뜨지만,
$ HISTFILE=/workspace/.gitpod/cmd-0 history -r; {
> nvm install
> }
Found '/workspace/codedang/.nvmrc' with version <v18.14.0>
Downloading and installing node v18.14.0...
Downloading https://nodejs.org/dist/v18.14.0/node-v18.14.0-linux-x64.tar.xz...
######################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v18.14.0 (npm v9.3.1)
$ node --version
v18.14.0
터미널을 새로 열면 16.x.x로 돌아가요(GitPod에 기본 설치된 버전).
$ node --version
v16.19.0
만약 gitpod에서 node 버전을 일정하게 유지하는 게 목적이라면 혹시 .gitpod.Dockerfile 파일에서
FROM gitpod/workspace-full:latest
대신에
FROM gitpod/workspace-full:2024-01-04-18-58-45
이런 방식으로 node 버전을 고정하는 건 어떤가요..?
workspace-images/CHANGELOG.md 에서 확인해보니 2023-10-19 이후의 빌드된 이미지라면 node 20이 기본으로 설정된 듯 합니다. 참고 - Docker hub - gitpod/workspace-full