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.
Community moderators have prevented the ability to post new answers.
I found a solution that works for me:
source ~/.nvm/nvm.sh && source ~/.profile && npm run updateprodSourcing NVM and the profile before calling NPM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.