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

Unable to find yarn after connecting to my server

piash tanjin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 30, 2024
image: atlassian/default-image:4
pipelines:
branches:
dev:
- step:
name: Deploying build
variable:
USER: $USER
SERVER: $SERVER
script:
- echo "Setting up SSH agent..."
- ssh -v $USER@$SERVER 'cd /home/ubuntu/api && ls && echo $PATH && /bin/bash deploy.sh'


following script works fine where my deploy.sh file can pull code from bitbucket but its unable to find yarn.

what is the problem ? i guess i am in docker environemnt which i got sure by $PATH. 

how to fix this issue to connect ec2 and run everything there? 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 2, 2024

Hi @piash tanjin and welcome to the community!

If I understand correctly, your deploy.sh script includes a yarn command, but you get a 'command not found error' when it runs. Is that correct?

Can you please provide the following info so I can better help you:

  • Is yarn installed on this server for this specific $USER that you log in with?

  • If you log in to this server as $USER (outside of Pipelines) and run the command which yarn, do you get in the output the path to yarn's executable?

  • Include the command echo $PATH in your deploy.sh script and run another build. Does the output of the echo $PATH command from the deploy.sh script include the path to yarn's executable?

If yarn is indeed installed on this server for this user, and the echo $PATH command in the deploy.sh script does not show yarn's path, you can add another command in the deploy.sh script to add it, e.g.

export PATH="$PATH:/path/to/yarn/"


On an unrelated note, please keep in mind that the following syntax in your yml file is not supported:

variable:
USER: $USER
SERVER: $SERVER

Variables can be defined in the yml only for custom pipelines, see the documentation:

Since you have a branch pipeline, the variables $USER and $SERVER will be available to the step if you define them as repository or workspace variables.

 

Just a heads up, I moved your post to a new question. Please create a new question if you need assistance instead of posting on someone else's, as an existing question may become convoluted if we try to troubleshoot multiple users' issues in it.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events