CircleCI-Public / node-orb

An orb for working with Node.js on CircleCI
https://circleci.com/orbs/registry/orb/circleci/node
MIT License
52 stars 80 forks source link

install-yarn does not work on machine executors #212

Closed blimmer closed 6 days ago

blimmer commented 6 months ago

Orb version:

5.2.0

What happened:

Latest version of Yarn is 1.22.21
Checking if YARN is already installed...
A different version of Yarn is installed (1.22.19); removing it
^@^@Installing YARN v1.22.21
Verifying YARN install
Something went wrong; the specified version of Yarn could not be installed

Exited with code exit status 1

Expected behavior:

The newer version of yarn should be installed without the error.

Additional Information:

The script installs the newer version of yarn to /usr/local/bin/yarn. However, on this machine executor (ubuntu-2204:2024.01.1), yarn is being pulled from nvm:

circleci@ip-10-0-169-43:~$ which yarn
/opt/circleci/.nvm/versions/node/v20.10.0/bin/yarn

Which is earlier in the PATH:

circleci@ip-10-0-169-43:~$ echo $PATH
/home/circleci/.go_workspace/bin:/usr/local/go/bin:/opt/google/google-cloud-sdk/bin:/opt/circleci/.rbenv/shims:/opt/circleci/.rbenv/bin:/opt/circleci/.pyenv/shims:/opt/circleci/.pyenv/bin:/usr/local/apache-maven/bin:/home/circleci/.yarn/bin:/home/circleci/.config/yarn/global/node_modules/.bin:/home/circleci/bin:/home/circleci/.go_workspace/bin:/usr/local/go/bin:/opt/google/google-cloud-sdk/bin:/opt/circleci/.rbenv/shims:/opt/circleci/.rbenv/bin:/opt/circleci/.pyenv/shims:/opt/circleci/.pyenv/bin:/usr/local/apache-maven/bin:/home/circleci/.yarn/bin:/home/circleci/.config/yarn/global/node_modules/.bin:/opt/circleci/.nvm/versions/node/v20.10.0/bin:/home/circleci/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/local/gradle-8.5/bin:/usr/local/gradle-8.5/bin

So the newer version being installed does not pass the final check https://github.com/CircleCI-Public/node-orb/blob/66a75a3bdb20f859a7dd807f9023d17f0a94fdc9/src/scripts/install-yarn.sh#L79-L86

marboledacci commented 1 week ago

This issue should be fixed in this new version https://circleci.com/developer/orbs/orb/circleci/node?version=6.1.0

blimmer commented 6 days ago

Great! Thanks. It looks like you added an integration test for this, so we should be able to close this.