How to build Grafana with a Yarn PR (for fixing Grafana broken in s390x systems)

  • What Grafana version and what operating system are you using?
    Grafana 9.0.2

  • What are you trying to achieve?
    I am trying to build Grafana 9.0.2 from source code on s390x system (also known as zLinux) with make run and yarn install, yarn start.

  • How are you trying to achieve it?
    After extracting the v9.0.2.tar.gz file I executed make run on the Grafana root folder. This succeeds without any issues. My go-lang version is: go version go1.17.11 linux/s390x

  • What happened?
    However when I run yarn install the following error:
    Internal Error: Execution failed with a non-error rejection (rejected value: “Runtime error: expected the system to be little-endian!”)
    at ys.error (/srv/grafana-install/grafana-9.0.2/.yarn/releases/yarn-3.2.1.cjs:390:305)
    at r (/srv/grafana-install/grafana-9.0.2/.yarn/releases/yarn-3.2.1.cjs:449:10957)

  • What did you expect to happen?
    An active issue is already logged with the yarn team ( [Feature] Big Endian Support · Issue #2745 · yarnpkg/berry ( regarding yarn broken in bigendian systems. However now a PR exists ( feat: big-endian support by paul-soporan · Pull Request #3669 · yarnpkg/berry ( where the issue has been fixed but yarn team have not merged this PR.
    Can some one please give me the steps where I can take this pull request and build yarn for this grafana release (9.0.2) so that yarn install and yarn start both will go through in big-endian systems such as s390x?

  • Can you copy/paste the configuration(s) that you are having problems with?
    grafana version: 9.0.2
    go version: go version go1.17.11 linux/s390x
    nodejs version: v16.15.1
    yarn version: 2.4.3
    npm version: 8.11.0

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    -sh-4.2$ sudo yarn install
    Internal Error: Execution failed with a non-error rejection (rejected value: “Runtime error: expected the system to be little-endian!”)
    at ys.error (/srv/grafana-install/grafana-9.0.2/.yarn/releases/yarn-3.2.1.cjs:390:305)
    at r (/srv/grafana-install/grafana-9.0.2/.yarn/releases/yarn-3.2.1.cjs:449:10957)

  • Did you follow any online instructions? If so, what is the URL?
    Followed the standard grafana install instructions.

This sounds more of a yarn question than a grafana issue.

I would

  1. Remove/uninstall yarn
  2. pull that yarn PR branch and build

Then run that version of yarn in the grafana you are trying to build

Thanks. I just found that the issue has been fixed in yarn v4.0.0-rc.12. We can set this version by executing: sudo yarn set version 4.0.0-rc.12
Also we need to set the yarn path in .yarnrc.yml to yarn-4.0.0-rc.12.cjs. An additional step will be to remove the old plugins (given below) from .yarnrc.yml:

  • path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
    spec: “@yarnpkg/plugin-typescript”
  • path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
    spec: “@yarnpkg/plugin-interactive-tools”

This will get yarn install to succeed in IBM s390x systems but yarn start or yarn watch will still fail due to this issue.

So is the issue with grafana or yarn on that distro?

The yarn install failing issue (due to little-endian error) was with yarn. The problem is fixed in yarn v4.0.0-rc.12 and yarn install now succeeds. But yarn start or yarn watch not working is with Grafana because it uses @swc/core, so a fix is needed from the swc team to switch intelligently from /core to /wasm for those architectures that are not supported.

I think that pretty much sums up your issue :point_up_2: “architecture that are not supported”. If not supported how can it switch intelligently?

I think you would be better off posting this in the grafana github discussion not in this forum where it might not get visibility

Actually I should have said “architectures that are currently not supported”. Anyways a fix is done for this issue by the swc team and you can see the details here even though I am yet to verify it.


Hi, I’m also currently trying to build 9.0.3, your hints have been invaluable :).

Would you like to join forces?