My action runner for github is failing. How do I resolve yarn: command not found. Process completed with exit code 127? - github

I was running a self hosted github action runner but my jobs were failing with this error message in the picture. I searched stackoverflow before posting the question but couldn't find any relevant threads. Let me know if there are threads that I missed.
How do I resolve this error so that my github action runner can run my CI builds again?

The built-in GitHub Action runners have yarn installed on them by default but a self-hosted runner won't unless you install it. See relevant issue here: https://github.com/actions/setup-node/issues/182.
If you don't want to install yarn on your self-hosted runner you can install it in the workflows that need it. Just make sure to uninstall it afterward to keep your self-hosted runners clean.
# You'll need to make sure node is installed first
- name: Install Node
uses: actions/setup-node#v3
with:
node-version-file: '.node-version'
- name: Install yarn
run: npm install -g yarn
# Do what you need to do with yarn
# Uninstall when you're done
- name: Clean up
if: always()
run: npm uninstall -g yarn

I realised that the issue was literally as described in the error that for some reason yarn was not found on my computer. This was a little strange as I remembered installing yarn before.
Nevertheless I ran
brew install yarn
And ran brew update and upgrade just in case my homebrew was outdated
brew update
brew upgrade
And it resolved the error and issues.

Related

ERROR:The serve command requires to be run in an Angular project, but a project definition could not be found

I am trying to clone the git repository for Tour of Heros with NgRX (blove/ngrx-tour-of-heros)
However, I can not seem to run the application.
I have updated my Angular cli to 7.3 I have installed yarn to try and help as well as tried to create a new application and remove files to drag and drop files that where not there like the node modules, and I am still getting this error.
How do I get this error removed so that I can see the file?
Check your build per-requisites, as illustrated by blove/ngrx-tour-of-heros issue 2
Breaking changes - node => 10
ERROR - "json-server requires at least version 4 of Node, please upgrade"
if your node -v is greater than 10, npm upgrade json-server
Appears that node-sass was optional on yarn install.
Had to install separately - yarn add none-sass
Also, cd client and cd server are reversed in lines 13 and 15.
The angular project is in de client directory, so after cloning the repo you have to get into the client directory before running the ng serve command:
git clone https://github.com/blove/ngrx-tour-of-heros.git
cd ./client
yarn install
npm run start
Seems like it's an older repo with Angular v5 and CLI v 1.6 - try downgrading if it doesn't work. https://github.com/blove/ngrx-tour-of-heros/blob/master/client/package.json#L32

Fastlane "nokogiri requires Ruby version >= 2.3.0." Error

I finished this tutorial on Medium in order to integrate my Xcode project with SonarQube to have some metrics. Setup SonarQube - Swift. I was able to make it through the last step that is: running fastlane metrics on the terminal while being in the root of the project directory. But I get this error on step "slather".
nokogiri requires Ruby version >= 2.3.0., fastlane finished with errors:
I have also found that someone had a similar question here, but no answers:
Similar Question
If I run:
nicolas$ ruby --version
I get ruby version 2.6.3, which is higher than the required 2.3
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
Does anyone knows how to fix this, or got any hunches? Thanks in advance, I appreciate any help.
After digging around and trying several solutions, I finally solved this. What happened was that I initially installed Fastlane with this command:
brew cask install Fastlane
And it seems that it was using another version of ruby while I had a newer one. So I uninstalled it with:
brew cask uninstall Fastlane
And then I re-installed it with this command:
sudo gem install -n /usr/local/bin fastlane -NV
Because I was having problems with permissions and then all worked good.
References and other solutions:
Github thread
usr/local/bin

Travis swift library compilation error

I'm trying to fix an error I have been getting from my Travis build lately and cannot seem to fix the issue:
The following build commands failed:
CompileSwift normal i386 /Users/travis/build/HarrisonEllerm/My-Pain-Manager/Pods/SwiftCharts/SwiftCharts/Layers/ChartPointsViewsLayer.swift
CompileSwiftSources normal i386 com.apple.xcode.tools.swift.compiler
(2 failures)
Everything else compiles just fine but this library for some reason throws an error each time. Does anyone know a possible solution to this problem (maybe telling Travis just to ignore the library?). It fails each time on that particular file, but I can open it up in Xcode no problem and it builds just fine locally.
Link to build: https://travis-ci.org/HarrisonEllerm/My-Pain-Manager
I have seen Get Travis CI to ignore an external library? but unfortunately no luck.
Cheers
I think you should add pod install command to your travis.yml file.
Updated before_install part:
before_install:
- rvm install ruby-2.2.2
- gem install cocoapods
- gem install xcpretty -N
- brew update
- brew install swiftlint || true #need to clean up project at some stage using swiftlint
- pod repo update
- pod install

Run Cypress.io on Azure Pipelines Hosted Linux Agent

I'm trying to run Cypress tests on the Hosted Linux Pool for Azure Pipelines. Unfortunately, the Hosted Agent doesn't have all the dependencies for Cypress installed.
Running the documented apt-get doesn't work:
2018-05-18T21:03:14.7423331Z ##[section]Starting: Install cypress dependencies
2018-05-18T21:03:14.7474742Z ==============================================================================
2018-05-18T21:03:14.7488281Z Task : Bash
2018-05-18T21:03:14.7501148Z Description : This is an early preview. Run a Bash script on macOS, Linux, or Windows
2018-05-18T21:03:14.7513088Z Version : 3.127.0
2018-05-18T21:03:14.7524823Z Author : Microsoft Corporation
2018-05-18T21:03:14.7537179Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613738)
2018-05-18T21:03:14.7549730Z ==============================================================================
2018-05-18T21:03:15.0174503Z Generating script.
2018-05-18T21:03:15.0535056Z Script contents:
2018-05-18T21:03:15.0547355Z apt-get install xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2
2018-05-18T21:03:15.0656822Z [command]/bin/bash --noprofile --norc /opt/vsts/work/_temp/cac4d3f9-42e7-49f3-94f6-7d0444827d83.sh
2018-05-18T21:03:15.6040707Z Reading package lists...
2018-05-18T21:03:15.6085335Z Building dependency tree...
2018-05-18T21:03:15.6153815Z Reading state information...
2018-05-18T21:03:15.6186788Z Package libgconf-2-4 is not available, but is referred to by another package.
2018-05-18T21:03:15.6198707Z This may mean that the package is missing, has been obsoleted, or
2018-05-18T21:03:15.6211380Z is only available from another source
2018-05-18T21:03:15.6216969Z
2018-05-18T21:03:15.6229592Z E: Unable to locate package xvfb
2018-05-18T21:03:15.6242128Z E: Unable to locate package libnotify-dev
2018-05-18T21:03:15.6254440Z E: Package 'libgconf-2-4' has no installation candidate
2018-05-18T21:03:15.6268141Z E: Unable to locate package libxss1
2018-05-18T21:03:15.6370826Z ##[error]Bash exited with code '100'.
2018-05-18T21:03:15.7283047Z ##[section]Finishing: Install cypress dependencies
Running apt-get update takes forever (25 minutes and still not done).
Any clues on how to get Cypress working quickly on the Hosted Agent is welcome.
Note: I tried running on Windows, that works, fortunately, so I'm not completely blocked. But to use the Windows Agent I now have 2 agent phases which adds overhead due to artefact downloads and npm install overhead.
Solved the issue using a pre-pended Shell (Bash) task in VSTS agent phase prior to running Cypress:
apt-get -qq -y update
apt-get -qq -y install xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2

Yarn: How to upgrade yarn version using terminal?

How should yarn be upgraded to the latest version?
For macOS users, if you installed yarn via brew, you can upgrade it using the below command:
brew upgrade yarn
On Linux, just run the below command at the terminal:
$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
On Windows, upgrade with Chocolatey
choco upgrade yarn
Credits:
Added answers with the help of the below answers
https://stackoverflow.com/a/54147594/842607
https://stackoverflow.com/a/53710422/842607
npm install --global yarn
npm upgrade --global yarn
This should work.
Not remembering how i've installed yarn the command that worked for me was:
yarn policies set-version
This command updates the current yarn version to the latest stable.
From the documentation:
Note that this command also is the preferred way to upgrade Yarn - it will work no matter how you originally installed it, which might sometimes prove difficult to figure out otherwise.
Reference
On Linux, just run below command at terminal:
$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
After do this, close the current terminal and open it again. And then, run below command to check yarn current version:
$ yarn --version
yarn policies set-version
will download the latest stable release
Referenced yarn docs
https://yarnpkg.com/lang/en/docs/cli/policies/#toc-policies-set-version
For Windows users
I usually upgrade Yarn with Chocolatey.
choco upgrade yarn
npm install -g yarn - solved the issue when nothing happened running npm update --global yarn.
Alternative method to update yarn: curl --compressed -o- -L https://yarnpkg.com/install.sh | bash.
Mac users with homebrew can run brew upgrade yarn.
More details here and here.
Works on all OS's
yarn set version latest
yarn set version from sources
Worked without the second line for me, but it is in the documentation for some reason.
Reference
I had an outdated symlink that was preventing me from accessing the proper bin. I had also recently gone through a node upgrade which means a lot of my newer bins were available in a different folder with what i think was a lower priority
Here is what worked for me:
yarn -v
> 1.15.2
which yarn
> /Users/lfender/.yarn/bin/yarn
rm -rf /Users/lfender/.yarn/bin/yarn
npm uninstall --global yarn; npm install --global yarn
> + yarn#1.16.0
> added 1 package in 0.179s
which yarn
> /Users/lfender/.nvm/versions/node/v12.2.0/bin/yarn
yarn -v
> 1.16.0
If you are not using NVM, the location of your bin installs are likely to be unique to your system
From there, I've switched to doing yarn policies set-version as outlined here https://stackoverflow.com/a/55278430/1426788 to define my yarn version at the repo level
According to https://yarnpkg.com/getting-started/install#updating-to-the-latest-versions
yarn set version <version>
For example to upgrade yarn v1.22.4 to v1.22.10:
yarn set version 1.22.10
I updated yarn on my Ubuntu by running the following command from my terminal
curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
source:https://yarnpkg.com/lang/en/docs/cli/self-update
Add Yarn Package Directory:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
Install Yarn:
sudo apt-get update && sudo apt-get install yarn
Please note that the last command will upgrade yarn to latest version if package already installed.
For more info you can check the docs: yarn installation
If you already have yarn 1.x and you want to upgrade to yarn 2. You need to do something a bit different:
yarn set version berry
Where berry is the code name for yarn version 2. See this migration guide here for more info.
I tried at first
yarn policies set-version
Then it directed me to run
yarn set version stable
You should implement them in order, the first command will download your current yarn version and update .yarnrc after that running the second command will upgrade yarn successfully to the latest stable version
I tried all of the above solutions in Jenkins pipeline which needs the latest yarn.
Finally, this worked for me.
Run yarn policies set-version in the git repo
This will generate .yarn/releases/yarn-X.X.X.js file and .yarnrc file. Push both of these files in the Git repo.
Now build and all the yarn commands will use the yarn-X.X.X version.
Note: This is helpful when you don't have root access to npm install -g yarn.
npm i -g yarn
This should update your yarn version. Check version with yarn -v or yarn --version.
yarn policies set-version --rc
As per the yarn documentation to update yarn to latest version we should run the above command. Check version with yarn -v or yarn --version.
Ref : https://classic.yarnpkg.com/en/docs/cli/policies/#toc-policies-set-version
yarn policies set-version
Use the above command in powershell to upgrade your current yarn version to Latest.It will download the latest yarn release
yarn policies set-version
this upgraded my yarn version from 1.22.5 to 1.22.10
If You want to upgrade your yarn version from 1.22.5 to 1.22.10
yarn policies set-version
To upgrade to latest version of yarn, run the below command on your terminal.
"yarn set version latest -g"
This work for me to change yarn version 0.32 git to 1.22.5
https://www.codegrepper.com/code-examples/shell/yarn+0.32+git+ubuntu
Since you already have yarn installed and only want to upgrade/update. you can simply use
yarn self-update
Find ref here https://yarnpkg.com/en/docs/cli/self-update