ng build is error after using the artifacts

Chanakya March 31, 2022

if i ran the "npm build " in the first step. It's working fine. but if i split the "npm run" to the next step it's failing and seeing the below error:

Error Block :

> xdex-ui@0.0.0 build /opt/atlassian/pipelines/agent/build
> ng build

Node.js version v4.2.1 detected.
The Angular CLI requires a minimum Node.js version of either v10.13 or v12.0.
Please update your Node.js version or visit https://nodejs.org/ for additional instructions.


npm ERR! Linux 5.13.0-1017-azure
npm ERR! argv "/bin/versions/node/v4.2.1/bin/node" "/bin/versions/node/v4.2.1/bin/npm" "run" "build" "--configuration=dev" "--optimization=false"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! xdex-ui@0.0.0 build: `ng build`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the xdex-ui@0.0.0 build script 'ng build'.
npm ERR! This is most likely a problem with the xdex-ui package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ng build
npm ERR! You can get their info via:
npm ERR! npm owner ls xdex-ui
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /opt/atlassian/pipelines/agent/build/npm-debug.log

My pipeline.yml

pipelines:  
  branches: 
    feature/cicd-test: 
      - step:
          name: install
          image: node:14.17.1 
          caches:
            - node
          script:
            - npm install  
          artifacts:
            - node_modules/**
      - step:
          name: deploy
          deployment: Dev
          trigger: manual
          script:
            - npm run build ## environment specific 
            - python3 deploy.py

 

please advise. 

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 4, 2022

Hi @Chanakya and welcome to the community.

For every step of your bitbucket-pipelines.yml file, a Docker container starts, the repo gets cloned, the commands of that step's script are executed, and then the container gets destroyed.

For the first step, you have defined an image, node:14.17.1. However, since no image is defined for the second step, the second step will use atlassian/default-image:latest as a build container that has an older version of node.

What you can do is either add image: node:14.17.1 in the definition of the second step as well, or add it at the top of your bitbucket-pipelines.yml file.

If you add it at the top of the yml file as follows:

image: node:14.17.1

pipelines:
branches:
feature/cicd-test:
[...]

then all the steps of your bitbucket-pipelines.yml file will use that image as a build container.

Kind regards,
Theodora

Chanakya April 5, 2022

Thanks Theodora,  it worked. after using the image: in second step. 

Also, my command is incorrect. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events