Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 877
mikemaccana Avatar asked Dec 24 '15 16:12

mikemaccana


2 Answers

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

like image 199
david.sansay Avatar answered Oct 20 '22 04:10

david.sansay


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]
like image 34
mikemaccana Avatar answered Oct 20 '22 04:10

mikemaccana