1

I want to run a Bash script in an Azure DevOps Pipeline, see below my yaml file:

trigger:
  - master

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0 
  inputs:
    versionSpec: '12.x'
    displayName: 'Install Node.js'

- task: Bash@3
  inputs:
    targetType: 'filePath'
    filePath: 'build.sh'

The pipeline is calling a "build.sh" script that calls node.js, and that is why I install the tool before running the script. However, I get the following message:

/home/vsts/work/1/s/build.sh: line 5: nodejs: command not found

This is the line 5 in the "build.sh" script, and it is working when I run it directly from my computer:

nodejs ../bin/r.js -o baseUrl=. optimize=none name=main out=main-built.js exclude=jquery.js

I have tried different approaches but cannot make it work. Any hint?

1 Answer 1

3

Please use node instead if nodejs

steps:
- task: NodeTool@0 
  inputs:
    versionSpec: '12.x'
  displayName: 'Install Node.js'

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: 'node --version'
- task: Bash@3
  continueOnError: true
  inputs:
    targetType: 'inline'
    script: 'nodejs --version'

then I got for node --version

v12.19.0

and for nodejs --version

/home/vsts/work/_temp/6287b2ad-1b03-48fd-a4df-3cf7ad6c9971.sh: line 1: nodejs: command not found

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.