Nvm does not change Node version on machine

Ok, Thanks for your patience. The primary issue, I think, is the alias command has to mention v10, not 10. Nvm was throwing an error, but thanks to it returning 0 as an exit code, we mark the step green.

(To be clear, the step being marked success on a zero exit code is expected behavior)

nvm alias default v10 works. See the below build.

https://circleci.com/gh/drazisil/circleci-testing/513

Here is my full config for posterity in case I nuke the repo, and the above thread is hard to follow,

version: 2
jobs:
  build:
  build:
    machine: true
    steps:
      - checkout
      - run: |
            echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
            echo ' [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
      - run: |
          node -v
      - run: |
          nvm install v10
          node -v
          nvm alias default v10
      - run: |
          node -v
2 Likes