# Unable to set node version with Circle 2.0

**URL:** <https://discuss.circleci.com/t/unable-to-set-node-version-with-circle-2-0/16461>\
**Category:** Build Environment\
**Tags:** nodejs, docker, circle-yml\
**Created:** [September 12, 2017, 9:26pm UTC](https://discuss.circleci.com/t/unable-to-set-node-version-with-circle-2-0/16461 "2017-09-12T21:26:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![damianesteban](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/damianesteban/32/14822_2.png) [@damianesteban](https://discuss.circleci.com/u/damianesteban)\
**Post date:** [September 12, 2017, 9:26pm UTC](https://discuss.circleci.com/t/unable-to-set-node-version-with-circle-2-0/16461/1 "2017-09-12T21:26:04Z")

</div>

I have tried out various circleci images from docker, and regardless of which one I choose the node version is _always the same_, v4.2.6.

Can anyone provide any guidance on how to change the version of node.js?

Thank you.

---

<div class="post-metadata">

**Author:** ![davesag](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/davesag/32/17675_2.png) [@davesag](https://discuss.circleci.com/u/davesag)\
**Post date:** [January 17, 2018, 7:56am UTC](https://discuss.circleci.com/t/unable-to-set-node-version-with-circle-2-0/16461/2 "2018-01-17T07:56:53Z")

</div>

I have the same issue.

My circle.yml is as follows

```
version: 2

jobs:
  build:
    docker:
      # specify the version you desire here
      - image: circleci/node:9.4.0
    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:
          name: Install dependencies
          command: npm install

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

      # run tests!
      - run:
          name: Linter
          command: npm run lint
      - run:
          name: Unit tests
          command: npm run test:unit
      - run:
          name: Integration tests
          command: npm run test:server

```

But the tests fail and in the logs I see

```
ERR! node v4.2.6
npm ERR! npm v2.14.12
```

---

<div class="post-metadata">

**Author:** ![halfer](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/halfer/32/9083_2.png) [@halfer](https://discuss.circleci.com/u/halfer)\
**Post date:** [May 23, 2018, 8:37pm UTC](https://discuss.circleci.com/t/unable-to-set-node-version-with-circle-2-0/16461/4 "2018-05-23T20:37:33Z")

</div>

I would guess this is a standard Linux debugging issue, and nothing to do with CircleCI _per se_. I wonder if there are several `npm` binaries in this container, and one has to use a fully-qualified path to get the right one?

If that does not work, you can always roll your own, which will, obviously, only contain the version you install. It is helpful to set this up as a separate build process, and then push to a public/private registry on successful image build.

---

<div class="post-metadata">

**Author:** ![davesag](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/davesag/32/17675_2.png) [@davesag](https://discuss.circleci.com/u/davesag)\
**Post date:** [May 24, 2018, 12:56am UTC](https://discuss.circleci.com/t/unable-to-set-node-version-with-circle-2-0/16461/5 "2018-05-24T00:56:17Z")

</div>

So just for the record, I worked out my issue. The file is meant to be called `.circleci/config.yml` not `.circleci/circle.yml`

The node version is being set correctly now.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [August 22, 2018, 12:56am UTC](https://discuss.circleci.com/t/unable-to-set-node-version-with-circle-2-0/16461/6 "2018-08-22T00:56:22Z")

</div>

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