Giter Site home page Giter Site logo

circleci-public / node-orb Goto Github PK

View Code? Open in Web Editor NEW
51.0 14.0 80.0 1.37 MB

An orb for working with Node.js on CircleCI

Home Page: https://circleci.com/orbs/registry/orb/circleci/node

License: MIT License

Shell 100.00%
circleci-orbs node node-js circleci circleci-orb orb hacktoberfest

node-orb's Introduction

node-orb's People

Contributors

amalfra avatar circlecai avatar cvan avatar dependabot[bot] avatar dotkas avatar dsanders11 avatar elimt avatar ericribeiro avatar eszjay avatar felicianotech avatar gerkindev avatar glenjamin avatar greatwizard avatar herschel666 avatar iynere avatar jabsci avatar jalexchen avatar jaryt avatar jenny-miggin avatar kdojeteri avatar kyletryon avatar lmammino avatar lokst avatar michaelgmcd avatar olleolleolle avatar peeja avatar royvandewater avatar sgerrand avatar snyk-bot avatar willheslam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-orb's Issues

Add ability to declare additional steps

Orb version

3.0.1

Expected behavior

Symmetrically to setup parameter in test job it would be handy to have teardown parameter to be able to notify about job result or publish test artifacts.

Feature: Accept multiple cache paths

Describe Request:

๐Ÿ‘‹ I was updating a project to run integration tests with Cypress. Cypress requires browsers installed in order to run the tests, and I understand neither versions v2, v3, and v4 of this orb will help me until support for browser image variants is provided for the "newer" docker images of nodejs.
image

So I stuck to v1 and all was good so far. Eventually, I ran into a caching issue because cypress since v3 and up is installing itself in the .cache folder, rather than in the node_modules folder as any other node package (see doc link). This orb, and I think every version of it, doesn't allow me to specify multiple cache paths. It defaults to .npm and does allow to override it, but not to specify more than one.

Is passing a list value possible? and, would you consider that change?

The alternatives I have today are:

  • Using this orb on v1 and add an extra step to globally install the cypress binary, instead of delegating that to the npm ci command.
  • Haven't tested, but I assume I could still use this orb on v1 and manually call the save_cache step passing the .cache folder key. Would look odd since I'm running those inside a "with-cache" named step that is supposed to take care of that for me.
  • Not using orbs, write the whole config script as usual. The downside is the verbosity.

Examples:

Supporting Documentation Links:

app-dir default to working_directory

Orb version

3.0.1

What happened

Error on node/install-packages

---
Unable to find your package.json file. Did you forget to set the app-dir parameter?
---

Current directory: /home/circleci/project

Expected behavior

I have working_directory set in my .circleci/config.yml and I feel that app-dir should default to that.

Thoughs? I would be willing to try my hand at a PR if this is even possible. Not sure CircleCI exposes the value of working_directory to orbs.

Support Yarn Zero Installs

Describe Request:

Support for Yarn v2 (a.k.a., berry) was recently introduced to the install-packages command. Yarn v2 introduces a great new feature called zero installs that allows dependencies to be cached in version control. As this is the recommended manner of using yarn, it would be ideal if the orb supported it. The presence of .yarn/cache/ and/or .pnp.cj before yarn install is run implies use of zero installs.

Considerations:

  • yarn install should be passed --immutable-cache in addition to --immutable since the cache is tracked in version control. This will correctly start failing builds in which the package.json does not match the contents of .yarn/cache/ or .pnp.cj.
  • Dependencies should not be cached using save_cache since this will reduce performance in return for nothing.
  • For added security, yarn install should be passed --check-cache, but only if a cache keyed off yarn.lock misses.
  • Partial cache restoration should not be used in conjunction with zero installs.
  • A parameter could be added to support only using --check-cache on forked builds (e.g., by inspecting CIRCLE_PR_REPONAME).
  • Thought should be given to how this feature interacts with the cache-path parameter based on the outcome of #61.

Workarounds:

For others using zero installs, I suggest replacing the install-packages command with the following until zero installs is supported:

- restore_cache:
    name: Restore cached lock file.
    key: v1-yarn-lock-file-{{ checksum "yarn.lock" }}
- run:
    name: Install dependencies, refetching if necessary for added security.
    command: |
      if diff --brief yarn.lock ~/.cache/yarn.lock 2> /dev/null
      then
        yarn install --immutable --immutable-cache
      else
        # See https://yarnpkg.com/features/zero-installs#does-it-have-security-implications
        yarn install --immutable --immutable-cache --check-cache
        mkdir --parents ~/.cache
        ln yarn.lock ~/.cache/yarn.lock
      fi
- save_cache:
    name: Cache lock file.
    key: v1-yarn-lock-file-{{ checksum "yarn.lock" }}
    paths:
      - ~/.cache/yarn.lock

If your yarn.lock is big, or you are extremely concerned with performance, you could replace the diff with a test for the presence of an empty file that you cache instead of yarn.lock. If you are unconcerned with the possibility of the cache being tampered with, then you could alternatively pass an override-ci-command of yarn install --immutable --immutable-cache and with-cache of false.

4.0.0 - NPM Install Failed

Orb version

4.0.0

      - node/install:
          node-version: 12.18.1

Workaround:

I update the configuration to:

      - node/install:
          node-version: 12.18.1
          install-npm: false

This works fine, since npm is already installed w/ node. However, I'd expect the defaults to work out of the box.

What happened

NPM install fails.

Latest version of NPM is 6.14.7
Something went wrong; the specified version of NPM could not be installed

Exited with code exit status 1

Expected behavior

NPM install works.

Cache based on .pnpm-lock.yaml

Describe Request:

It would be nice to be able to cache based on .pnpm-lock.yaml when using pnpm as a package manager in the install-packages command.
Granted, this might amount to "npm support."

Examples:

jobs:
  test:
    - run:
        name: install pnpm
        command: sudo npm i -g pnpm
    - checkout
    - node/install-packages:
        override-ci-command: pnpm i
        cache-path: ~/.pnpm-store

Supporting Documentation Links:

pnpm CI integration docs

Add machine image tests

We encountered a bug with machine images resulting in new Node versions not being set while using nvm. This was addressed in #73, but we had to remove the machine image tests as the nvm version was for whatever reason incompatible with the commands we're running. These will need to be re-added once the next tag is released with the updated nvm command.

Only restoring cache

In our pipeline we are installing packages as the first job in the pipeline and then restoring the cache in future jobs.

- node/install-packages

However, this does a restore cache/install/save cache

I think we only need to restore cache in our future jobs and do not need to run npm install again.

Given the cache key is generated automatically, would you advise against manually restoring the cache?

node-deps-v1-{{ branch }}-{{ checksum 'package-lock.json' }}

Screenshot 2020-06-30 at 10 49 54

We would save 30s on our pipeline but not sure if that'd cause any issues.

Cannot install Node on MacOS executor

Orb version

1.1.6

What happened

Attempting to run node/install on a MacOS executor is failing due to missing gpg and sha256sum commands. Here is the relevant section of the CircleCI config:

  build-ios:
    macos:
      xcode: '11.1.0'
    working_directory: ~/repo
    steps:
      - checkout
      - node/install:
          node-version: '10.16.3'

And the output from running the job:

Selected version of Node.js is 10.16.3
A different version of Node.js is installed (v12.10.0); removing it
Importing Node.js trusted release keys...
/bin/bash: line 155: gpg: command not found
/bin/bash: line 164: sha256sum: command not found
grep: SHASUMS256.txt: No such file or directory

Expected behavior

The node installation should complete successfully.

cache-only-lockfile=true still uses package.json on save_cache step

Orb version: 5.0.0

What happened:

The default install-packages command with cache-only-lockfile true tries to restore the cache path that looks like (simplified version)

node-deps-{{ arch }}-<<parameters.cache-version>>-{{ .Branch }}-{{ checksum "/tmp/node-project-lockfile" }}

but saves a cache with the key:

node-deps-{{ arch }}-<<parameters.cache-version>>-{{ .Branch }}-{{ checksum "/tmp/node-project-package.json" }}-{{ checksum "/tmp/node-project-lockfile" }}

which means that restore always falls back to the version that restores without caring about the lockfile.

Expected behavior:

The save_cache cache key should match the most specific restore_cache key attempt.

Ignore package.json in favor of the lock file when installing packages

Describe Request:

install-packages should allow configuration to ignore the package.json file when constructing the cache string. Considering the package.json checksum for cache invalidation will introduce many unnecessary cache invalidations when a lock file is also present.

** I can't speak to package-lock.json, but my projects use yarn, so I can say at least this is applicable to yarn.lock.

  1. The yarn.lock file is a good metric for determining whether the dependency graph has changed and can be used alone irrespective of the package.json checksum. When it exists, it can stand alone.
  2. There's a lot of information stored in package.json that has nothing to do with dependencies. If a developer changes any number of things including "description", "scripts", or 3rd-party configs (e.g. eslint, prettier, etc configs within package.json), cache will be invalidated. This adds unnecessary delay (and cost) to a CI job execution.

I understand that this could be a breaking change if not added as an optional parameter, so I'm fine with that. As-is, I cannot use this orb job (though I'd like to), because the unnecessary cache invalidations result in unnecessary costs via longer job times.

Examples:

Supporting Documentation Links:

Windows support

Orb version

2.0.3

What happened

Version check fails on windows

Expected behavior

Script should work on all platforms including windows

This line fails on windows when trying to produce a cross-platform matrix script.

Here's my config (adapted from one of the CircleCI blogposts):

version: 2.1

executors:
  windows: win/default
  node: node/default

orbs:
  node: circleci/[email protected]
  win: circleci/[email protected]

jobs:
  test:
    parameters:
      os:
        type: executor
      node-version:
        type: string
    executor: << parameters.os >>
    steps:
      - checkout
      - node/install:
          node-version: '<< parameters.node-version >>'
          install-yarn: false
          install-npm: false
      - run: npm install
      - run: npm test

workflows:
  all-tests:
    jobs:
      - test:
          matrix:
            parameters:
              os: [node, windows]
              node-version: ['0.10.48', '0.12.18', '6.17.1', '8.17.0', '10.20.1', 'current', 'latest']

Error messages:

Missing '(' after 'if' in if statement.
At line:13 char:7
+   if [[ latest == "" || latest == "latest" || latest == "current" ]]; ...
+       ~
Missing type name after '['.
At line:13 char:22
+   if [[ latest == "" || latest == "latest" || latest == "current" ]]; ...
+                      ~~

I'm not sure if I'm doing this wrong or if I have unrealistic expectations! Let me know!

Installing Node on "executor: machine" fails

Orb version:

4.1.0

What happened:

https://app.circleci.com/pipelines/github/cypress-io/cypress-docker-images/343/workflows/a16f93ea-cf0f-4934-9c6f-55292f3219d0/jobs/21538

Trying to install Node lts on the Circle machine

- node/install:
    lts: true

Fails with the following error message

npm ERR! peer dep missing: eslint@>=3.1.0, required by [email protected]

Full error

#!/bin/bash -eo pipefail
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
NVM_DIR="$HOME/.nvm"
echo "export NVM_DIR=\"$HOME/.nvm\"" >> $BASH_ENV
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && \. \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
source $BASH_ENV
nvm install \
  --lts 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13527  100 13527    0     0   102k      0 --:--:-- --:--:-- --:--:--  102k
=> nvm is already installed in /opt/circleci/.nvm, trying to update using git
=> => Compressing and cleaning up git repository

=> nvm source string already in /home/circleci/.bashrc
=> Appending bash_completion source string to /home/circleci/.bashrc
npm ERR! peer dep missing: eslint@>=3.1.0, required by [email protected]
=> You currently have modules installed globally with `npm`. These will no
=> longer be linked to the active version of Node when you install a new node
=> with `nvm`; and they may (depending on how you construct your `$PATH`)
=> override the binaries of modules installed with `nvm`:

/opt/circleci/.nvm/versions/node/v6.1.0/lib
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
=> If you wish to uninstall them at a later point (or re-install them under your
=> `nvm` Nodes), you can remove them from the system Node as follows:

     $ nvm use system
     $ npm uninstall -g a_module

=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="/opt/circleci/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Exited with code exit status 1
CircleCI received exit code 1

Expected behavior:

Install Node v12

Additional Information:

Spelling mistake in description.

Small description update. Should be included in next patch update.

"Easily install Node.js and its package mangers (npm, yarn). Best of all, install your packages with caching enabled by default."

mangers > managers

Yarn 2 support

The orb currently supports Yarn 1, but requires these parameter overrides to work with Yarn 2:

# Yarn 2 deprecates "--frozen-lockfile" in favour of "--immutable"
override-ci-command: yarn install --immutable

# Yarn 2 uses this rather than "node_modules"
cache-path: .yarn/cache

It would be good if the orb supports Yarn 2 natively; perhaps by adding a Yarn 2 option to the pkg-manager parameter?

"npm ci" cannot be executed

Orb version

2.1.0

What happened

node/install-packages command executes:

  • npm install by default
  • npm install with override-ci: false
  • npm install with override-ci: true

Expected behavior

node/install-packages command should execute:

  • npm ci by default
  • npm ci with override-ci: false
  • npm install with override-ci: true

From the description of override-ci:

By default, modules will be installed with "npm ci" or "yarn install --frozen-lockfile", this override will use the standard "install" command.

Also the same problem occurs with yarn.


Cause

The if statement is wrong.

if [[ << parameters.override-ci >> ]]; then

It should be

if [[ << parameters.override-ci >> == true ]]; then

or

if << parameters.override-ci >>; then 

Additional issue: cache

After solving the tiny bug above, the next problem is the cache.
Currently node/install-packages command caches/restores node_modules directory, but it doesn't work for npm ci because npm ci removes node_modules first.
So it should cache ~/.npm for npm ci instead.

Unable to cache based on `npm-shrinkwrap.json`...

Orb version:

circleci/[email protected]

What happened:

when your node project uses an npm-shrinkwrap.json file (docs), jobs fail to restore or save cache:

error computing cache key: template: cacheKey:1:30: executing "cacheKey" at <checksum "~/project/package-lock.json">: error calling checksum: open /home/circleci/project/package-lock.json: no such file or directory

Expected behavior:

cache key should be calculated using either package-lock.json (as it does today) or npm-shrinkwrap.json

MacOS install compatibility.

Orb version

What happened

@ganezasan has found that the Yarn install incorrectly installs under MacOS due to including an incorrect PATH (for MacOS).

https://github.com/CircleCI-Public/node-orb/blob/master/src/commands/install-yarn.yml#L21

First reported here: https://discuss.circleci.com/t/having-fork-resource-temporarily-unavailable-when-running-commands-on-macos/30966/4?u=jcm

The incorrect path leads to slow processes on MacOS and errors similar to the following:
^D^D/tmp/.bash_env-5d10d6f32cffde0008c4dc34-0-build: fork: Resource temporarily unavailable

Expected behavior

Detect OS and change install path (@ganezasan has mentioned removing this line would work).

node/install-packages with Yarn does not use cache

Orb version:

circleci/[email protected]

What happened:

This is my configuration for this orb:

- node/install-packages:
          pkg-manager: yarn

but always the "Installing YARN packages" step install the packages instead of using the cache.

This is the outpout of the "Restoring cache" step:

Found a cache from build 28614 at node-deps-arch1-linux-amd64-6_85-v1-update-circle-ci-orbs-5iWF2YzHP8e1G6HhzxszgwKVJ5IrCah37qVy9y7D96U=-pCvIcgffSUKf4AQQJL2DcbU1PjkyP85xag3cObI_gM8=
Size: 32 B
Cached paths:
  * /home/circleci/yarn.lock

Downloading cache archive...
Validating cache...

Unarchiving cache...

I've also tried to use cache-path: ~/project/node_modules but it didn't work, in fact it wasn't used at all.

Should not the cached path be the following? * /home/circleci/project/yarn.lock

Using the version 2 of this orb (the current one in my project) the cached path used is this one: * /home/circleci/project/node_modules

Expected behavior:

It should skip installing packages if there is a cache.

Specified version of NPM could not be installed

Orb version: 4.7.0

  run_generate:
      executor: node/default
      parameters:
        BASE_URL:
          type: string
      environment:
        BASE_URL: << parameters.BASE_URL >>
      steps:
        - checkout
        - node/install:
            lts: true
        - node/install-npm
        - run:
            command: |
              npm ci --prefer-offline --no-audit
              npm run generate

What happened:

#!/bin/bash -eo pipefail
if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi

# FUNCTIONS
get_npm_version () {
    if [[ "$NODE_PARAM_NPM_VERSION" == latest ]]; then
    NPM_ORB_VERSION="$(npm view npm | sed -E 's|.*-||g' | grep latest | \
        perl -pe 's/.*: //g' | perl -pe "s/'|,//g")"

    echo "Latest version of NPM is $NPM_ORB_VERSION"
    else
    NPM_ORB_VERSION="$NODE_PARAM_NPM_VERSION"

    echo "Selected version of NPM is $NPM_ORB_VERSION"
    fi
}

installation_check () {
    if command -v npm > /dev/null 2>&1; then
    if npm -v | grep "$NPM_ORB_VERSION" > /dev/null 2>&1; then
        echo "NPM $NPM_ORB_VERSION is already installed"
        exit 0
    fi
    fi
}

get_npm_version
installation_check

if [ "$NODE_PARAM_NPM_VERSION" = latest ]; then
$SUDO npm install -g npm@latest > /dev/null 2>&1 || \
    npm install -g npm@latest > /dev/null 2>&1
else
$SUDO npm install -g "npm@$NPM_ORB_VERSION" > /dev/null 2>&1 || \
    npm install -g "npm@$NPM_ORB_VERSION" > /dev/null 2>&1
fi

# test/verify version
if npm -v | grep "$NPM_ORB_VERSION" > /dev/null 2>&1; then
echo "Success! NPM $(npm -v) has been installed to $(which npm)"
else
echo "Something went wrong; the specified version of NPM could not be installed"
exit 1
fi

Latest version of NPM is 8.1.4
Something went wrong; the specified version of NPM could not be installed

Exited with code exit status 1
CircleCI received exit code 1

Expected behavior:

Install NPM

Additional Information:

Starting from 2.x version it's not possible to install Node dependencies with custom commands/flags

Orb version

2.0.2

What happened

After switching from 1.x version, I lose the possibility to run custom steps while installing Node dependencies. Before I used for specifying some flags for yarn install command. I tried also to add yarn install command to package.json scripts, but that didn't work properly since it's running yarn install as usual first and then custom yarn install from package.json.
Here is an example of how I installed the deps before:

  install_deps:
    steps:
      - node/with-cache:
          cache-version: v1
          cache-key: yarn.lock
          dir: ~/repo/node_modules
          use-strict-cache: true
          steps:
            - run: yarn install --pure-lockfile --ignore-scripts --no-progress

And to install just prod deps:

  install_deps:
    steps:
      - node/with-cache:
          cache-version: v1
          cache-key: yarn.lock
          dir: ~/repo/node_modules
          use-strict-cache: true
          steps:
            - run: yarn install --prod --pure-lockfile --ignore-scripts --no-progress

Expected behavior

I want to be able to run a custom command or at least flags for the package manager while installing the dependencies.

  install_deps:
    steps:
      - node/install-packages:
          app-dir: ~/repo
          cache-version: v1
          cache-key: yarn.lock
          override-ci: true
          override-ci-flags: --prod --pure-lockfile
          pkg-manager: yarn

Or

  install_deps:
    steps:
      - node/install-packages:
          app-dir: ~/repo
          cache-version: v1
          cache-key: yarn.lock
          override-ci: true
          override-ci-command: yarn install --prod --pure-lockfile --ignore-scripts --no-progress
          pkg-manager: yarn

Yarn install does not use the cache-path parameter

Orb version:

4.1.0

What happened:

I have the following configuration:

version: 2.1

orbs:
  node: circleci/[email protected]

jobs:
  test:
    docker:
      - image: cimg/node:12.18.2
        auth:
          username: $DOCKERHUB_USERNAME
          password: $DOCKERHUB_PASSWORD
    steps:
      - checkout
      - node/install-packages:
          pkg-manager: yarn
          cache-path: ~/.cache/yarn

workflows:
  test:
    jobs:
      - test:
          context:
            - docker-hub-creds

There is, unfortunately, no visual way to describe what I think is happening, because yarn install's output is the same whether the dependencies are cached or not. Only the duration can be an indicator, but it's too variable between jobs to be reliable.

If I understand correctly the code, when cache-path is specified, that's the path which will be cached by save_cache.
That path is, however, not used by yarn install, unless I override the command with override-ci-command: yarn install --frozen-lockfile --cache-folder ~/.cache/yarn.

Expected behavior:

The yarn install command uses the cache directory specified by cache-path.
Alternatively, the documentation could be clarified to explain that the install command needs to be overridden with override-ci-command to specify the cache folder.
Currently the documentation for the cache-path parameter is confusing for yarn users:

By default, this orb will utilize 'npm ci' and cache the '~/.npm' directory. Override which path to cache with this parameter.

Additional Information:

AFAIK, this is also true for npm.
I haven't used recent versions of npm and I don't know how its cache works, though.

Occasional flake when setting up node

Orb version:

5.0.0

What happened:

We occasionally see flaky builds where node or NPM fails to install. For example, here's the output from one recent failure:

failure output
#!/bin/bash -eo pipefail
# Only install nvm if it's not already installed
if command -v nvm &> /dev/null; then
    echo "nvm is already installed. Skipping nvm install.";
else
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash;
    
    echo 'export NVM_DIR="$HOME/.nvm"' >> "$BASH_ENV";
    echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --no-use' >> "$BASH_ENV";
    
    # shellcheck source=/dev/null
    source "$BASH_ENV";
fi

# See: https://github.com/nvm-sh/nvm#usage
if [ "$NODE_PARAM_VERSION" = "latest" ]; then
    # When no version is specified we default to the latest version of Node
    NODE_ORB_INSTALL_VERSION=$(nvm ls-remote | tail -n1 | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')
    nvm install "$NODE_ORB_INSTALL_VERSION" # aka nvm install node. We're being explicit here.
    nvm alias default "$NODE_ORB_INSTALL_VERSION"
    elif [ -n "$NODE_PARAM_VERSION" ]; then
    nvm install "$NODE_PARAM_VERSION"
    nvm alias default "$NODE_PARAM_VERSION"
    elif [ -f ".nvmrc" ]; then
    NVMRC_SPECIFIED_VERSION=$(<.nvmrc)
    nvm install "$NVMRC_SPECIFIED_VERSION"
    nvm alias default "$NVMRC_SPECIFIED_VERSION"
else
    nvm install --lts
    nvm alias default lts/*
fi

echo 'nvm use default &>/dev/null' >> "$BASH_ENV"

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13527  100 13527    0     0  1016k      0 --:--:-- --:--:-- --:--:-- 1016k
=> Downloading nvm from git to '/home/circleci/.nvm'
=> Cloning into '/home/circleci/.nvm'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Failed to clone nvm repo. Please report this!

Exited with code exit status 2

CircleCI received exit code 2

Expected behavior:

Node should reliably install in the container.

Feat: ARM Support

Describe Request:

Enable support for ARM-based installation and execution for CircleCI's upcoming ARM build fleet.

Examples:

  • Install Node on ARM-based executor
  • Test all functionality

Supporting Documentation Links:

CircleCI ARM build fleet: https://www2.circleci.com/arm.html

Orb in sample configs is out of date

Orb version:

N/A

What happened:

I added a new project to CCI using the config builder. I couldn't figure out why it was behaving differently from what the documentation saidโ€”in particular, it wasn't installing the version of Node listed in my .nvmrc. Turns out it had given me circleci/[email protected].

Expected behavior:

Config builder should suggest circleci/node@5 instead.

Additional Information:

I know this isn't really a change to me made in this repo, but I'm not sure where else to file this. ๐Ÿ˜„

The install command does not make global node or npm commands available

Orb version

1.0.1

What happened

The install command does not install node or npm into the $PATH. Consequently, downstream scripts that expect a global node or npm command will not work.

Expected behavior

The install command should make global node and npm commands available to downstream scripts.

Yarn install fails due to gzip error

Orb version:

4.7 and 5.01

What happened:

Tried to install Node 14.19 and Yarn, it errors with gzip: stdin: not in gzip format, tar: Child returned status 1

Additional Information:

Circle Config Command:

  - node/install:
      install-yarn: true
      node-version: '14.19'

I was getting this error on orb version 4.7, upgraded to 5.01 and still getting the error. Guessing it's an issue with the latest Yarn build?
It just started happening today, was running multiple builds and then it just stopped working.

Build log:

#!/bin/bash -eo pipefail
if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi

# FUNCTIONS
get_yarn_version () {
    if [[ "$NODE_PARAM_YARN_VERSION" == "" ]]; then
    YARN_ORB_VERSION=$(curl -Ls -o /dev/null -w "%{url_effective}" \
        "https://github.com/yarnpkg/yarn/releases/latest" | sed 's:.*/::' | cut -d 'v' -f 2 | cut -d 'v' -f 2)
    echo "Latest version of Yarn is $YARN_ORB_VERSION"
    else
    YARN_ORB_VERSION="$NODE_PARAM_YARN_VERSION"

    echo "Selected version of Yarn is $YARN_ORB_VERSION"
    fi
}

installation_check () {
    echo "Checking if YARN is already installed..."
    if command -v yarn > /dev/null 2>&1; then
    if yarn --version | grep "$YARN_ORB_VERSION" > /dev/null 2>&1; then
        echo "Yarn $YARN_ORB_VERSION is already installed"
        exit 0
    else
        echo "A different version of Yarn is installed ($(yarn --version)); removing it"

        if uname -a | grep Darwin > /dev/null 2>&1; then
        brew uninstall yarn > /dev/null 2>&1
        elif grep Alpine /etc/issue > /dev/null 2>&1; then
        apk del yarn > /dev/null 2>&1
        elif grep Debian /etc/issue > /dev/null 2>&1; then
        $SUDO apt-get remove yarn > /dev/null 2>&1 && \
            $SUDO apt-get purge yarn > /dev/null 2>&1
        elif grep Ubuntu /etc/issue > /dev/null 2>&1; then
        $SUDO apt-get remove yarn > /dev/null 2>&1 && \
            $SUDO apt-get purge yarn > /dev/null 2>&1
        elif command -v yum > /dev/null 2>&1; then
        yum remove yarn > /dev/null 2>&1
        fi

        $SUDO rm -rf "$HOME/.yarn" > /dev/null 2>&1
        $SUDO rm -f /usr/local/bin/yarn /usr/local/bin/yarnpkg > /dev/null 2>&1
    fi
    fi
}

# cd to home so that yarn --version will not use relative installed yarn from .yarn/releases
cd ~ || echo "Cannot change directory to home directory, yarn version may be mismatched."

get_yarn_version
installation_check

# install yarn
echo "Installing YARN v$YARN_ORB_VERSION"
curl -L -o yarn.tar.gz --silent "https://yarnpkg.com/downloads/$YARN_ORB_VERSION/yarn-v$YARN_ORB_VERSION.tar.gz"

$SUDO tar -xzf yarn.tar.gz && rm yarn.tar.gz

$SUDO mkdir -p /opt/yarn
$SUDO mv yarn-v"${YARN_ORB_VERSION}"/* /opt/yarn

$SUDO rm -rf "yarn-v${YARN_ORB_VERSION}"

$SUDO chmod 777 "/opt/yarn"

$SUDO ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn
$SUDO ln -s /opt/yarn/bin/yarnpkg /usr/local/bin/yarnpkg
$SUDO ln -s /opt/yarn/bin/yarn.js /usr/local/bin/yarn.js

$SUDO mkdir -p ~/.config

if uname -a | grep Darwin; then
    $SUDO chown -R "$USER:$GROUP" ~/.config
    $SUDO chown -R "$USER:$GROUP" /opt/yarn
else
    $SUDO chown -R "$(whoami):$(whoami)" /opt/yarn
    $SUDO chown -R "$(whoami):$(whoami)" ~/.config
fi

# test/verify version
echo "Verifying YARN install"
if yarn --version | grep "$YARN_ORB_VERSION" > /dev/null 2>&1; then
    echo "Success! Yarn $(yarn --version) has been installed to $(which yarn)"
else
    echo "Something went wrong; the specified version of Yarn could not be installed"
    exit 1
fi

Latest version of Yarn is 1.22.18
Checking if YARN is already installed...
A different version of Yarn is installed (1.22.5); removing it
Installing YARN v1.22.18

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
mv: cannot stat 'yarn-v1.22.18/*': No such file or directory

Exited with code exit status 1

CircleCI received exit code 1

Needs usage examples

Orb version

1.0.0

What happened

The orb needs usage examples. I spent a not of time trying to figure out how to use the executor.

Expected behavior

Usage examples :)

Yarn installation fails if Yarn policies are in use

Orb version:

5.0.0

What happened:

I'm using Yarn policies (e.g., yarn policy set-version 1.22.11) to bundle Yarn with my app. .yarnrc looks like this:

# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


lastUpdateCheck 1579039968308
yarn-path ".yarn/releases/yarn-1.22.11.js"

I'm trying to use this orb to install Node and Yarn, like so:

- node/install:
    install-yarn: true

This downloads the latest stable version of Yarn, which is 1.22.17 at the time of writing. Unfortunately, the installation process fails at the end with this error:

Verifying YARN install
Something went wrong; the specified version of Yarn could not be installed

This happens because after the Yarn installation is complete (1.22.17 is successfully installed) yarn --version returns 1.22.11, which is the version specified in .yarnrc. This mismatch causes the process to exit.

Expected behavior:

I'm not sure, to be honest! A few options are possible:

  • if the Yarn installation process somehow respected the contents of .yarnrc that would help
  • if it was possible to skip the version check, that might be good
  • if the installation check was smarter and checked policies that would help as well

I could hard-code the Yarn version in the task config, but that defeats the purpose of using .yarnrc. I could also somehow parse .yarnrc myself and extract the version, but that's the yarn executable's job. Any advice here would be appreciated!

Both `pnpm` and `yarn` do not populate package binaries after package installation

Orb version:

circleci/[email protected]

What happened:

Neither pnpm nor yarn do not populate binaries after installing dependencies. So for example after pnpm install or yarn commands eslint is not available when invoking with either of them in package.json scripts. Only after installing those packages globally are they available to run. Below is a screenshot of the failing job.
image
I've also tried to SSH and checked myself. Binaries are actually not created for some reason. See the screenshot.
image

Also here is part of the config that defines that job:

version: 2.1
orbs:
  node: circleci/[email protected]
...
jobs:
  dev_eslint:
    executor:
      name: node/default
      tag: 'lts'
    steps:
      - checkout
      - run:
          name: Node.js version
          command: node --version
      - run:
          name: Install pnpm@6
          command: |
            yarn global add pnpm esbuild
            pnpm config set store-dir ~/.pnpm-store
      - restore_cache:
          keys:
            - v1-deps-{{ checksum "pnpm-lock.yaml" }}
      - node/install-packages:
          override-ci-command: pnpm install
          with-cache: false
      - save_cache:
          paths:
            - ~/.pnpm-store
          key: v1-deps-{{ checksum "pnpm-lock.yaml" }}
      - run:
          name: Run ESLint project-wide
          command: |
            export TIMING=1 && pnpm prettier:client:base --check
            pnpm eslint:client --quiet && pnpm lint:css
            pnpm prettier:server:base --check
            pnpm eslint:server --quiet
            pnpm prettier:common:base --check
            pnpm eslint:common --quiet

I had issues with installing pnpm the way their docs suggest that global install was not permitted so I found myself using yarn global add pnpm which actually succeeded.

Let me know if you need more details.

Expected behavior:

Create package binaries and successfully invoke from package.json scripts.

Additional Information:

node/install is unstable

Orb version

2.1.0

What happened

      - node/install:
          install-yarn: true
          node-version: latest

results in the Installing NodeJS Latest job
The installing run time is very unstable. The worst cases were more than 10mins and 20mins even. And it would fail sometimes due to timeout.

Expected behavior

  1. Fast and stable installation
  2. Well, we can cache the docker layer after this step ourselves too but it'd be nice too if this job automatically does it.

Please consider using several partial keys in restore_cache

Describe Request:

It is very common, and actually recommended in the CircleCI documentation, that we specify several keys in restore_cache, so that the cache can be reused and primed even if the underlying lock files change.

For example, Here is a real-life configuration from my project:

Saving is:

      - save_cache:
          paths:
            - node_modules
          key: v2-dependencies-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}

Restoring is:

      - restore_cache:
          keys:
            - v2-dependencies-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
            - v2-dependencies-{{ checksum "package.json" }}-
            - v2-dependencies-

But this isn't what the orb is doing:

- when: # Restore cache for NPM
condition: << parameters.with-cache >>
steps:
- restore_cache:
keys:
- node-deps-<<parameters.cache-version>>-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}-<</parameters.include-branch-in-cache-key>>{{ checksum "<<parameters.app-dir>>/package-lock.json" }}

- when: # Restore cache for YARN
condition: << parameters.with-cache >>
steps:
- restore_cache:
keys:
- node-deps-<<parameters.cache-version>>-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}-<</parameters.include-branch-in-cache-key>>{{ checksum "<<parameters.app-dir>>/yarn.lock" }}

Is there a drawback to always doing this? Or should we make this a configuration option?

I'd be happy looking at this if there is consensus about it.

Thanks!

Not working with cimg/ruby

Orb version:

4.7.0

What happened:

When setting up the build environment on cimg/ruby:2.7.4-browsers, this orb fails when checking npm. It succeeds in installing node:

Install Node.js 14.18.1
#!/bin/bash -eo pipefail
# Only install nvm if it's not already installed
if command -v nvm &> /dev/null; then
    echo "nvm is already installed. Skipping nvm install.";
else
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash;
    echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV;
    echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --no-use' >> $BASH_ENV;
    source $BASH_ENV;
fi

if [ "$NODE_PARAM_LTS" = "1" ]; then
    nvm install --lts
    nvm alias default lts/*
else
    nvm install "$NODE_PARAM_VERSION"
    nvm alias default "$NODE_PARAM_VERSION"
fi

echo 'nvm use default &>/dev/null' >> $BASH_ENV

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13527  100 13527    0     0  1016k      0 --:--:-- --:--:-- --:--:-- 1016k
=> Downloading nvm from git to '/home/circleci/.nvm'
=> Cloning into '/home/circleci/.nvm'...
Warning: Permanently added the ECDSA host key for IP address '140.82.112.3' to the list of known hosts.
remote: Enumerating objects: 333, done.        
remote: Counting objects: 100% (333/333), done.        
remote: Compressing objects: 100% (283/283), done.        
Receiving objects: 100% (333/333), 177.15 KiB | 8.05 MiB/s, done.
remote: Total 333 (delta 38), reused 150 (delta 25), pack-reused 0        
Resolving deltas: 100% (38/38), done.
=> Compressing and cleaning up git repository

=> Appending nvm source string to /home/circleci/.bashrc
=> Appending bash_completion source string to /home/circleci/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
Downloading and installing node v14.18.1...
Downloading https://nodejs.org/dist/v14.18.1/node-v14.18.1-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v14.18.1 (npm v6.14.15)
Creating default alias: default -> 14.18.1 (-> v14.18.1 *)
default -> 14.18.1 (-> v14.18.1 *)

CircleCI received exit code 0

But then it fails when setting up NPM:

Install NPM
#!/bin/bash -eo pipefail
if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi

# FUNCTIONS
get_npm_version () {
    if [[ "$NODE_PARAM_NPM_VERSION" == latest ]]; then
    NPM_ORB_VERSION="$(npm view npm | sed -E 's|.*-||g' | grep latest | \
        perl -pe 's/.*: //g' | perl -pe "s/'|,//g")"

    echo "Latest version of NPM is $NPM_ORB_VERSION"
    else
    NPM_ORB_VERSION="$NODE_PARAM_NPM_VERSION"

    echo "Selected version of NPM is $NPM_ORB_VERSION"
    fi
}

installation_check () {
    if command -v npm > /dev/null 2>&1; then
    if npm -v | grep "$NPM_ORB_VERSION" > /dev/null 2>&1; then
        echo "NPM $NPM_ORB_VERSION is already installed"
        exit 0
    fi
    fi
}

get_npm_version
installation_check

if [ "$NODE_PARAM_NPM_VERSION" = latest ]; then
$SUDO npm install -g npm@latest > /dev/null 2>&1 || \
    npm install -g npm@latest > /dev/null 2>&1
else
$SUDO npm install -g "npm@$NPM_ORB_VERSION" > /dev/null 2>&1 || \
    npm install -g "npm@$NPM_ORB_VERSION" > /dev/null 2>&1
fi

# test/verify version
if npm -v | grep "$NPM_ORB_VERSION" > /dev/null 2>&1; then
echo "Success! NPM $(npm -v) has been installed to $(which npm)"
else
echo "Something went wrong; the specified version of NPM could not be installed"
exit 1
fi

Latest version of NPM is 8.1.4
Something went wrong; the specified version of NPM could not be installed

Exited with code exit status 1

CircleCI received exit code 1

Expected behavior:

It should successfully install NPM.

Additional Information:

This works fine on the legacy circleci/ruby:2.7.4-node-browsers image.

Node/install times out causing build fail

Orb version

v1.1.6

What happened

I have the following circle config:

version: 2.1
orbs:
  aws-cli: circleci/[email protected]
  jq: circleci/[email protected]
  node: circleci/[email protected]
docker:
  - image: alpine:3.7
jobs:
  build_and_deploy_lambda:
    parameters:
      deploy_env:
        type: string
        description: "The environment that we're deploying to. Either 'dev', 'stage', or 'prod'."
    executor: aws-cli/default
    steps:
      - checkout
      - aws-cli/setup
      - node/install:
          install-yarn: false
          node-version: "10.17.0"
      - run: ./deploy_function -e << parameters.deploy_env >>

The majority of the time this works with no issues, but a small portion of the time we're seeing the following from the node/install step:

Selected version of Node.js is 10.17.0
Importing Node.js trusted release keys...
Too long with no output (exceeded 10m0s): context deadline exceeded

We would like a way to address this, even if that is the ability to bump the timeout for whatever internal orb request is failing.

Expected behavior

The orb does not time out on node/install and if that is unavoidable (since you folks don't control node.js servers) then we have the ability to bump the install timeout so that this issue does not happen as often ๐Ÿคž.

Docs don't explain how to install specific node version

The docs state:

Download and install any version of Node.js. Optionally installs Yarn with a parameter. You may use the default executor of this orb for a Node execution environment as well.

Yet no YML directive or API is documented for how to do this. This could use clarification as I don't quite understand what the docs are trying to say.

Cannot run `node/install-packages` running using a Ramdisk

Orb version: circleci/node@5

What happened:

Cannot run node/install-packages running using a Ramdisk (CircleCI doc).

Extract from config.yml:

    working_directory: /mnt/ramdisk
    steps:
      - checkout
      - node/install-packages

Error:

ln: failed to create hard link '/tmp/node-project-lockfile' => 'package-lock.json': Invalid cross-device link

Expected behavior:

Running in a Ramdisk should still allow to install packages.

Additional Information:

Full error:

#!/bin/bash -eo pipefail
if [ -f "package-lock.json" ]; then
  echo "Found package-lock.json file, assuming lockfile"
  ln package-lock.json /tmp/node-project-lockfile
elif [ -f "npm-shrinkwrap.json" ]; then
  echo "Found npm-shrinkwrap.json file, assuming lockfile"
  ln npm-shrinkwrap.json /tmp/node-project-lockfile
elif [ -f "yarn.lock" ]; then
  echo "Found yarn.lock file, assuming lockfile"
  ln yarn.lock /tmp/node-project-lockfile
fi
ln package.json /tmp/node-project-package.json

Found package-lock.json file, assuming lockfile
ln: failed to create hard link '/tmp/node-project-lockfile' => 'package-lock.json': Invalid cross-device link

Exited with code exit status 1

CircleCI received exit code 1

config.yml:

version: 2.1

orbs:
  node: circleci/node@5

jobs:
  build:
    docker:
      - image: cimg/node:14.18.1
    working_directory: /mnt/ramdisk
    steps:
      - checkout
      - node/install-packages:
          include-branch-in-cache-key: false

Edit: upgraded to circleci/node@5

curl fails with 404 on installing node version 12

Orb version

1.1.6

What happened

Installation of version "12" with version "13" already installed yields:

Selected version of Node.js is v12.13.0
A different version of Node.js is installed (v13.0.1); removing it
Importing Node.js trusted release keys...
curl: (22) The requested URL returned error: 404 
Exited with code 22
CircleCI received exit code 22

run with step:

...
      - node/install:
          node-version: "12"
...

I believe this is caused by the VERSION variable already being prefixed with v yielding an invalid URL here: https://github.com/CircleCI-Public/node-orb/blob/master/src/commands/install-node.yml#L195-L197

Expected behavior

It should remove node version 13 and install node version 12.

Orb behaviour with restore_cache does not match what source code says it should be doing

Orb version: 5.0.0

What happened:

In our node/install-packages step, I notice the restore_cache output to be something like this:

No cache is found for key: node-deps-arch1-linux-amd64-6_85-v1-WEBPLAT-1424-otawg9WNM0SS_vutk39ZUPxQPgxUCFt5g4TXo9whdYs=
Found a cache from build 188495 at node-deps-arch1-linux-amd64-6_85-v1-WEBPLAT-1424-3zVE04aLnLzo5ttkKIxeRB9NIhoXVIiqLiwkGMKBONA=

After which npm ci runs for 5 minutes or so. After that is done, I notice that it is skipping cache generation with such a message

Skipping cache generation, cache already exists for key: node-deps-arch1-linux-amd64-6_85-v1-WEBPLAT-1424-3zVE04aLnLzo5ttkKIxeRB9NIhoXVIiqLiwkGMKBONA=-otawg9WNM0SS_vutk39ZUPxQPgxUCFt5g4TXo9whdYs=

Expected behavior:

Based on the source code as I see here:

- restore_cache: # Include branch and package.json checksum if defined. Prioritize lock-file as it is a more definitive version of dependency cache.
keys:
- node-deps-{{ arch }}-<<parameters.cache-version>>-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}-<</parameters.include-branch-in-cache-key>><<^parameters.cache-only-lockfile>>{{ checksum "/tmp/node-project-package.json" }}-<</parameters.cache-only-lockfile>>{{ checksum "/tmp/node-project-lockfile" }}
- node-deps-{{ arch }}-<<parameters.cache-version>>-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}-<</parameters.include-branch-in-cache-key>>{{ checksum "/tmp/node-project-package.json" }}
- node-deps-{{ arch }}-<<parameters.cache-version>>-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}-<</parameters.include-branch-in-cache-key>>
My expectation
is that during the cache restore step, it would have searched for the same cache key that eventually got generated npm ci step.

Additional Information:

Additional context from our config.yaml:

  node: circleci/[email protected]

We're running node/install-packages with no custom parameters.

Yarn Berry installs fail

Orb version:

5.0.0

What happened:

Installing YARN Packages job failed when using yarn-berry without zero installs - the else statement to execute yarn install --immutable is unreachable.

https://app.circleci.com/pipelines/github/CleverFew/Parcelify-Components/39/workflows/5e34dadf-205d-46f7-a8b9-7b9614d86546/jobs/24

Internal Error: Cache path does not exist.
    at Nt.setup (/home/circleci/project/.yarn/releases/yarn-3.2.0.cjs:430:1519)
    at async Function.find (/home/circleci/project/.yarn/releases/yarn-3.2.0.cjs:430:728)
    at async Cm.execute (/home/circleci/project/.yarn/releases/yarn-3.2.0.cjs:501:12109)
    at async Cm.validateAndExecute (/home/circleci/project/.yarn/releases/yarn-3.2.0.cjs:349:673)
    at async Is.run (/home/circleci/project/.yarn/releases/yarn-3.2.0.cjs:363:2087)
    at async Is.runExit (/home/circleci/project/.yarn/releases/yarn-3.2.0.cjs:363:2271)
    at async i (/home/circleci/project/.yarn/releases/yarn-3.2.0.cjs:448:12669)
    at async r (/home/circleci/project/.yarn/releases/yarn-3.2.0.cjs:448:10887)

Expected behavior:

Yarn should not use the --immutable-cache flag when the cache location doesn't exist

Additional Information:

The negation in this expression is a bug - the zero installs is only executing when the cache directory doesn't exist which is incorrect:

if [[ ! -f "$PARAM_CACHE_PATH" ]]; then

Temporary workaround: override-ci-command: yarn install --immutable

yarn config needs sudo on macos

Orb version

1.1.0

What happened

Running yarn config set cache-folder ~/.cache/yarn now needs sudo. It's weird for it to ask for sudo since it should be installed for the current user.

This started happening after upgrading from 1.0.1 to 1.1.0 to get the fixes from #5

Expected behavior

Should run without sudo(?)

If that is expected please let me know.

Node fails to install on macos

Orb version:

This failure was observed using 4.0.1 and 4.1.0. The failure went away under 3.0.1 as that version does not use nvm, so looks like a nvm error. I did not investigate further so as to not waste my mac minutes and that 3.0.1 worked.

What happened:

#!/bin/bash --login -eo pipefail
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
NVM_DIR="$HOME/.nvm"
echo "export NVM_DIR=\"$HOME/.nvm\"" >> $BASH_ENV
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && \. \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
source $BASH_ENV
nvm install \
 12.13.1  
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13527  100 13527    0     0   209k      0 --:--:-- --:--:-- --:--:--  213k
=> Downloading nvm from git to '/Users/distiller/.nvm'
=> Cloning into '/Users/distiller/.nvm'...
remote: Enumerating objects: 290, done.        
remote: Counting objects: 100% (290/290), done.        
remote: Compressing objects: 100% (257/257), done.        
remote: Total 290 (delta 34), reused 110 (delta 20), pack-reused 0        
Receiving objects: 100% (290/290), 163.37 KiB | 4.54 MiB/s, done.
Resolving deltas: 100% (34/34), done.
=> Compressing and cleaning up git repository

=> Appending nvm source string to /Users/distiller/.bashrc
=> Appending bash_completion source string to /Users/distiller/.bashrc
N/A: version "12.13.0 -> N/A" is not yet installed.

You need to run "nvm install 12.13.0" to install it before using it.
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
N/A: version "12.13.0 -> N/A" is not yet installed.

You need to run "nvm install 12.13.0" to install it before using it.

Exited with code exit status 3
CircleCI received exit code 3

Expected behavior:

Node would be installed, and build would not fail

Additional Information:

Stripped down build config:

version: 2.1

orbs:
  node: circleci/[email protected]

jobs:
  build:
    macos:
      xcode: '11.4'
    environment:
      HOMEBREW_NO_AUTO_UPDATE: 1

    steps:
      - checkout

      - run:
          name: Setup dependencies
          command: brew install unixodbc gnupg coreutils

      - node/install:
          install-yarn: true
          node-version: "12.13.1"

workflows:
  version: 2
  build:
    jobs:
      - build

install-yarn runs into cert issue (workaround: curl insecure)

Orb version:

circleci/[email protected]

What happened:

- node/install:
    install-yarn: true
    install-npm: false
    node-version: 16.13.0
    yarn-version: 1.22.17

led to:

Selected version of Yarn is 1.22.17
Checking if YARN is already installed...
Installing YARN v1.22.17

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
mv: cannot stat 'yarn-v1.22.17/*': No such file or directory

Expected behavior:

an installed yarn.

Additional Information:

I found a workaround and a possible explanation for why this failed to install

https://discuss.circleci.com/t/yarn-install-failing-node-orb/41477

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.