It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bitbucket pipelines node server run pm2 issues Edited


below is my package.json script section

"test": "cd ./app/ && mocha --timeout 15000",

"build": "cd ./app && pm2 start app.js",

and below is my bitbucket-pipelines.yml file 

image: node:10.15.1
pipelines: default:

- step: caches: - node

script: # Modify the commands below to build your repository.

- yarn

- yarn build

- yarn test

 my pm2 has successfully configured on bitbucket pipelines

pm2 working.png

and this is below  test fail which works seamlessly on my local machine with pm2   :





can we investigate on same and provide with solution on same .

how do i check whether my server is running or not and proceed with other end to end features testing like login mechanism 

1 answer

0 votes
Graham Gatus Atlassian Team Apr 16, 2019

@matt baker its been a while since this was posted. Did you manage to get pm2 working? Make sure that the command to start your app via pm2 and the tests happen within the same step.


I tried running an extremely minimal express.js app with pm2, and didn't run into any issues:



image: node:8.15.1-jessie

- step:
- npm install -g pm2
- npm install
- pm2 start server.js
- curl http://localhost:3000



const express = require('express');
const app = express();

app.get('/', (req, res) => {
res.send("Hello World!");

const port = 3000;
const server = app.listen(port, () => {
console.log(`Listening on http://localhost:${port}`);


"name": "nodejs-pm2-express",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"repository": {
"type": "git",
"url": "git+ssh://"
"keywords": [],
"author": "",
"license": "ISC",
"homepage": "",
"dependencies": {
"express": "^4.16.4"

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Atlassian supported Jenkins integration for Bitbucket Server

We’ve been building a plugin to integrate Bitbucket Server and Jenkins CI, and I’m excited to announce that our alpha is ready to download and install. It lets you seamlessly configure a Jenkins job ...

453 views 0 10
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you