Skip to content

YARN problem #1143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
thelubomir opened this issue Oct 5, 2024 · 6 comments
Closed

YARN problem #1143

thelubomir opened this issue Oct 5, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@thelubomir
Copy link

Hello! here is my pipeline
name: Deploy to DEV server

on:
push:
branches:
- dev

jobs:
deploy_dev:
runs-on: self-hosted

steps:
  - name: Checkout code
    uses: actions/checkout@v4
    with:
      ref: dev

  - name: Set up SSH
    uses: webfactory/ssh-agent@v0.9.0
    with:
      ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY_RUNNER }}

  - name: Add SSH known hosts
    run: |
      mkdir -p ~/.ssh
      ssh-keyscan -p ${{ secrets.SSH_PORT }} ${{ secrets.HOST_DEV }} >> ~/.ssh/known_hosts

  - name: Deploy to server
    run: |
      ssh -p ${{ secrets.SSH_PORT }} ${{ secrets.HOST_USER }}@${{ secrets.HOST_DEV }} << 'EOF'
        cd /home/app
        git checkout dev
        git pull origin dev
        yarn
        yarn db:migrate
        pm2 restart crm_backend
      EOF

In "deploy to server" section got errors:
-bash: line 4: yarn: command not found
-bash: line 5: yarn: command not found
/usr/bin/env: ‘node’: No such file or directory

Could you please help with how to fix?

@thelubomir thelubomir added bug Something isn't working needs triage labels Oct 5, 2024
@gowridurgad
Copy link
Contributor

Hi @thelubomir 👋,
Thank you for reporting this issue. We will investigate it and get back to you as soon as we have some feedback.

@mahalakshmi-rekadi mahalakshmi-rekadi self-assigned this Oct 7, 2024
@mahalakshmi-rekadi
Copy link

Hello @thelubomir , The errors you're encountering in the "Deploy to server" section indicate that the yarn command and node are not found on the remote server. This issue is not related to the setup-node step in the GitHub Actions workflow itself, but rather to the environment on the remote server where the deployment is being executed.

@mlitvinav
Copy link

@thelubomir @Osama2535 this is an issue with the setup-node action not beeing able to find the latest node version on your self-hosted runner.

If you click on the setup-node action, you will see something like this:

Run actions/setup-node@v3
Environment details
  node: 
  npm: 
  yarn: 

Notice, preinstalled things have not been found. But you should see something like this:

Run actions/setup-node@v3
Found in cache @ /opt/runner/_work/_tool/node/18.20.4/x64
Environment details
  node: v18.20.4
  npm: 10.7.0
  yarn: 1.22.22

I use the setup-action as follows, which works for me:

      - uses: actions/setup-node@v3
        with:
          node-version: 18.x

There can be many issues why its not working. The support for self-hosted runners is pretty bad.
I would recomment to pin your desired node-version in setup-node action and making sure its mounted into the runner.
You can double check it by searching for node on the runner as follows.

find / -name node -type f 2>/dev/null

Its probably somewhere here /opt/runner/_work/_tool/node/....

@mahalakshmi-rekadi
Copy link

Hello @thelubomir, We are awaiting for your response on the issue. Please let us know if we can close this issue if there are no further queries.

@thelubomir
Copy link
Author

Hello! Yes, we can close the issue. thank you all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants
@thelubomir @mlitvinav @gowridurgad @mahalakshmi-rekadi and others