node.jssemaphore-ci

Upgrading NodeJS on SemaphoreCI


I'm using NodeJS and running the project through SemaphoreCI. The project works fine on my machine but fails on Semaphore. I suspect that it is because of node version difference (mine is v5.5, Semaphore is using v0.12).

Google gave me so many results on how to upgrade my node, but almost all of these need sudo access. I was wondering if anyone had similar issues on Semaphore.


Solution

  • Semaphore gives you full sudo access, so you can run any linux command as you do in your dev environment, here is example from the Semaphore docs.

    Full list of preinstalled versions of NodeJS on Semaphore you can find here. As you can see, there is no 5.5 version on the platform so you need to install and switch to it with following commands as part of your build:

    nvm install 5.5
    nvm use 5.5
    

    If you want to use some version that is already preinstalled you can do that with following command:

    nvm use 5.6