Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap order of steps in npm install example #147

Merged
merged 1 commit into from
May 16, 2022

Conversation

willheslam
Copy link
Contributor

If node/install-packages comes first, the packages will already be installed
before the correct version of npm has been installed.

It'll look something a bit like this:

        environment:
          PARAM_CACHE_PATH: ''
          PARAM_OVERRIDE_COMMAND: npm install
        name: Installing NPM packages
        working_directory: .
    - save_cache:
        key: node-deps-{{ arch }}-v1-{{ .Branch }}-{{ checksum "/tmp/node-project-lockfile" }}
        paths:
        - ~/.npm
    - run:
        command: rm -f /tmp/node-project-lockfile /tmp/node-project-package.json /tmp/yarn-zero-lockfile
        name: Remove temporary links
    - run:
        command: sudo npm install -g npm@latest

whereas presumably we want something like this instead:

    - checkout
    - run:
        command: "# Only install nvm if it's not already installed\..."
        environment:
          NODE_PARAM_VERSION: '16.14'
        name: Install Node.js 16.14
    - run:
        command: sudo npm install -g npm@latest
    - run:
        command: |-
          # Fail if package.json does not exist in working directory

          if [ ! -f "package.json" ]; then

If `node/install-packages` comes first, the packages will already be installed
before the correct version of npm has been installed.
@willheslam willheslam requested a review from a team as a code owner April 5, 2022 01:16
Copy link
Contributor

@Jaryt Jaryt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Thanks for submitting this change!

@orb-publisher
Copy link

Your development orb has been published. It will expire in 30 days.
You can preview what this will look like on the CircleCI Orb Registry at the following link:
https://circleci.com/developer/orbs/orb/circleci/node?version=dev:07efe30dbfbb3b9049ca38e4844ceacab8af55e4

@Jaryt Jaryt merged commit 0535356 into CircleCI-Public:master May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants