Description
Description:
Changing node versions inside a container doesn't seem to work
Action version:
v2
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Tools version:
node 16.13.1
Repro steps:
build:
name: Jekyll Site Build
needs: fetch-data
runs-on: ubuntu-latest
container: jekyll/jekyll:4.0
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: download data
uses: actions/download-artifact@v2
with:
name: _data
path: src/_data
- name: set up node
uses: actions/setup-node@v2
with:
node-version-file: '.node-version'
cache: 'yarn'
- name: get node version
run: node --version; npm --version; which -a node; echo $PATH
- name: install correct yarn version
run: npm install --global --force yarn@1.22.17
- name: install dependencies
run: make yarn-install
The install of the new node seems to succeed, but the original node installed (presumably with the Jekyll container) is used, so our install of yarn dependencies fails b/c we are looking for a newer node (v16.13 vs v12). The path seems to be correct - output of the debug strings:
Run actions/setup-node@v2
with:
node-version-file: .node-version
cache: yarn
always-auth: false
check-latest: false
token: ***
/usr/bin/docker exec f8d48febda1aa59150d1fdd5992c3516ac1b3b41c6447d718f7e84b115143750 sh -c "cat /etc/*release | grep ^ID"
Resolved .node-version as 16.13.1
Found in cache @ /__t/node/16.13.1/x64
/usr/bin/yarn --version
1.19.2
/usr/bin/yarn cache dir
/usr/local/share/.cache/yarn/v6
yarn cache is not found
Run node --version; npm --version; which -a node; echo $PATH
node --version; npm --version; which -a node; echo $PATH
shell: sh -e {0}
v12.22.1
8.1.2
/__t/node/16.13.1/x64/bin/node
/usr/bin/node
/__t/node/16.13.1/x64/bin:/usr/jekyll/bin:/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
So which can find the right node, and the right node seems to be at the front of the path, but in the context the wrong node is still being used. This may not be a bug this may be something we are doing wrong.
Expected behavior:
Installing a new node, then running a yarn install, should use that new node.
Actual behavior:
It seems to be still using the old (prebaked as part of container?) node, v12.