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 fails stating sudo command not found #208

Open aquacode opened 6 months ago

aquacode commented 6 months ago

Orb version:

5.2.0

What happened:

I'm using node-orb 5.2.0 on a CircleCI Windows image based on the Orb circleci/windows version 2.2.0

I'm using the following config:

` manage-node-npm:
description: "Install node and yarn". steps:

Expected behavior:

install-yarn should succeed but instead I see the following output:

Latest version of Yarn is 1.22.21 Checking if YARN is already installed... Installing YARN v1.22.21 bash: line 56: sudo: command not found bash: line 58: sudo: command not found bash: line 59: sudo: command not found bash: line 61: sudo: command not found bash: line 63: sudo: command not found bash: line 65: sudo: command not found bash: line 66: sudo: command not found bash: line 67: sudo: command not found bash: line 69: sudo: command not found bash: line 75: sudo: command not found bash: line 76: sudo: command not found Verifying YARN install bash: line 81: yarn: command not found Something went wrong; the specified version of Yarn could not be installed

Exited with code exit status 1

Additional Information:

This used to work and suddenly it isn't

marboledacci commented 1 week ago

This orb is not fully compatible with windows, so it is trying to install using linux commands. Fortunately the windows images come with node installed, so you can take advantage of corepack to install yarn. Just add a new step before the install command, and run corepack enable. With this, yarn will be installed so the command won't try to reinstall and fail.

The update for your configuration would be like this:

  manage-node-npm:
    steps:
      - run: corepack enable
      - node/install:
          install-yarn: true
          node-version: "14.18.0"