mikemaccana
mikemaccana

Reputation: 123198

CircleCI ignores node version specified in circle.yml

My circle.yml is set to install the current stable version of node per CircleCI's docs:

machine:
  node:
    version: 4.2.2

However Circle seems to be ignoring this and using the default pre-stable version of node. Amongst my error messages:

npm ERR! node v0.10.33
npm ERR! npm  v2.13.5

How can I make CircleCI use the version of node specified in it's config file?

Upvotes: 7

Views: 2956

Answers (2)

mikemaccana
mikemaccana

Reputation: 123198

I'm not sure what specifically I fixed, but here's my current working CircleCI config. Note Circle's old Ubuntu needs a newer compiler to run the current stable version of node.

machine:
  node:
    version: 4.2.2

# From for occasional ELIFECYCLE errors compiling microtime
# https://discuss.circleci.com/t/using-node-js-4-0-on-circleci/26
dependencies:
  pre:
    - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt-get update
    - sudo apt-get install -y gcc-4.9 g++-4.9
    - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 10
    - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 10
    - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20
    - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20
    # Circle uses npm v2 by default
    - npm install -g [email protected]

Upvotes: 1

david.sansay
david.sansay

Reputation: 1399

You can only choose a version that is pre installed in the OS. node 4.2.6 is now the default version for Ubuntu 14.

Ubuntu 14 has: https://circleci.com/docs/build-image-trusty/#nodejs

Ubuntu 12 has: https://circleci.com/docs/build-image-precise/#nodejs

Upvotes: 11

Related Questions