Installing a specifc node version on both Windows and Linux Builds

Eduardo Terry's Avatar

Eduardo Terry

03 Jul, 2018 11:41 AM

I am trying to install node version 10.3.0 in both the windows and linux image however the following fails on the linux image with "Install-Product : The term 'Install-Product' is not recognized as the name of a cmdlet, function, script file, or operable program."

image:
  - Ubuntu
  - Visual Studio 2017

# Test against the latest version of this Node.js version
environment:
  nodejs_version: "10.3.0"

# Install scripts. (runs after repo cloning)
install:
  # Get the latest stable version of Node.js or io.js
  - ps: Install-Product node $env:nodejs_version

How can I install a specific version of node in bother images

  1. Support Staff 1 Posted by Ilya Finkelshte... on 03 Jul, 2018 06:12 PM

    Ilya Finkelshteyn's Avatar

    Sorry for confusion. Install-Product is for Windows only. For Ubuntu please use nvm or our new language stack construct. To run different configurations for Linux and Windows side-by-side, please check this part of doc.

    For example, this is one of the options to express this in YAML, for me it is quite simple and compact:

    image:
    - Visual Studio 2017
    - Ubuntu
    environment:
      nodejs_version: 10.3.0
    install:
    - cmd: powershell Install-Product node $env:nodejs_version
    - sh: nvm install $nodejs_version
    

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac