Node version in 2.0


#1

With CircleCI 2.0 I’m unable to set the version of node.js - regardless of what image I use it always uses v4.2.6


A way to define the latest and/or stable version of node in .yml
#2

On 2.0 you can build a container and install what you need.


#3

Yes but doesn’t it stand to reason that a container tagged as node:8.0 would have node.js v8.0 installed? I really want to use circle but headaches like this…


#4

Can you clarify what you’re doing to see those results? Everything looks fine.

$ docker run -it circleci/node:8.0 bash
circleci@cb5b1c27de50:/$ node --version
v8.0.0
circleci@cb5b1c27de50:/$ npm --version
5.0.0

#5

I’m seeing the same thing. I’m specifying the 7.1 image but getting 4.2.6 in tests.

If I use debug ssh I can see the wrong node version:

ubuntu@box800:~$ node --version
v4.2.6

My config.yml

version: 2
jobs:
  build:
    docker:
      - image: circleci/node:7.10
        environment:
          NODE_ENV: test

      - image: postgres:9.5
        environment:
          POSTGRES_USER: ubuntu
          POSTGRES_DB: test
    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run: npm install

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      - run:
          name: Wait for db
          command: dockerize -wait tcp://localhost:5432 -timeout 1m

      # run tests!
      - run: npm test

#6

Resolved this. :flushed:

Someone pushed to a branch that didn’t have a .circleci/config.yml while I was testing. I didn’t notice this when I hit Rebuild with SSH, so I rebuilt the build that was without a config, and so, obviously, it had the wrong node version.

(unsurprisingly) Rebuilding on a branch with a config.yml solved it.


#7

Glad you got this sorted. Reminds me of this blog post I wrote. Notably, “Working on Teams Can Be Hard”.


#8

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.