Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,466,091
Community Members
 
Community Events
176
Community Groups

bash npm command not found

Edited

Hello everyone,

I am trying to setup a pipeline to deploy to production.

Using pipe: atlassian/ssh-run:0.4.1 I just want to execute an npm command on my production server.

The pipeline gives an error:

bash: npm: command not found

When connected as the same SFTP user on the production server terminal, npm -v successfully gives me the version: 6.9.0.

Having hard time understanding the difference between accessing SSH with a Bitbucket Pipeline and direct access to SSH.

I only setup 4 repository variables, called: SFTP_SERVER, SFTP_USER, SFTP_PASSWORD, and SFTP_PATH.

Help appreciated. Thanks.

The pipeline config file is:

image: php:7.4-fpm
definitions:
services:
mysql:
image: mysql:5.7
environment:
MYSQL_DATABASE: 'homestead'
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_USER: 'homestead'
MYSQL_PASSWORD: 'secret'
pipelines:
default:
- step:
name: Deploy to Production
deployment: production
script:
- pipe: atlassian/ssh-run:0.4.1
variables:
SSH_USER: $SFTP_USER
SERVER: $SFTP_SERVER
MODE: 'command'
DEBUG: 'true'
COMMAND: 'npm run updateprod'
PASSWORD: $SFTP_PASSWORD
LOCAL_PATH: $SFTP_PATH

Update: found some info saying that paths can be different when connected in SSH in "non interactive mode". Still trying to find how to handle the difference.

 

1 answer

I found a solution that works for me:

source ~/.nvm/nvm.sh && source ~/.profile && npm run updateprod

Sourcing NVM and the profile before calling NPM.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS

Atlassian Community Events