Open stovmascript opened 6 months ago
Can you run grit init
? Where did you install from?
I tried both with and without grit init
(it's stated as optional).
This output is after installing via curl -fsSL https://docs.grit.io/install | bash
in a Docker container. But I did also try using the npm installation on my host machine and ran into the same error.
grit init
actually produces the same error:
root@7ca230e16e58:/srv# grit init
Initialized grit config at /srv/.grit/grit.yaml
Error: Invalid grit.yml: patterns[0].samples[1]: missing field `output` at line 22 column 9
We have tests that run it, so I'm having trouble finding the root cause. Could you try replicating in a CodeSandbox?
Oops, looks like the npm installed version on my host machine actually works.
That's interesting, since they should theoretically end up with the same final binary.
I'll try to reproduce the error in some public container.
Tried in this "Devbox": https://codesandbox.io/p/devbox/heuristic-danny-kjl98p and works just fine 🤔
It must be related to the container somehow (I'm running a Dev Container in VS Code), will investigate more. The npm version which failed previously was also in the container. Here's how I build the container:
FROM node:18-slim AS base
WORKDIR /srv
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
# Extends the base stage for development purposes. Installs additional tools
# like 'git-lfs' and 'imagemagick' needed for development but not for
# production.
FROM base AS base-devcontainer
RUN apt-get update \
&& apt-get install -y --no-install-recommends git-lfs imagemagick librsvg2-bin \
&& rm -rf /var/lib/apt/lists/* \
&& curl -fsSL https://docs.grit.io/install | bash
So it seems I'm missing something in my Docker image. It works when I try the same image as CodeSandbox provides on my machine:
$ docker run -v $(pwd)/src:/srv/src --platform linux/amd64 -ti ghcr.io/codesandbox/devcontainers/typescript-node:latest /bin/bash
Unable to find image 'ghcr.io/codesandbox/devcontainers/typescript-node:latest' locally
latest: Pulling from codesandbox/devcontainers/typescript-node
71215d55680c: Pull complete
3cb8f9c23302: Pull complete
5f899db30843: Pull complete
567db630df8d: Pull complete
f4ac4e9f5ffb: Pull complete
f672111fb160: Pull complete
24ef680837cc: Pull complete
2547ae49d6c8: Pull complete
08f7a45f0547: Pull complete
b451652d0088: Pull complete
8ca4ce5b3e39: Pull complete
9090063f40e9: Pull complete
2d2439cd4b94: Pull complete
37ee7a2f6407: Pull complete
9acb27fc15ca: Pull complete
1b90a1e3e664: Pull complete
39cea12fd075: Pull complete
d237a1c7695d: Pull complete
4f4fb700ef54: Pull complete
0b30e681b422: Pull complete
5c7bc42fa5d7: Pull complete
d0d3fd0b91f5: Pull complete
797993222d25: Pull complete
5c7db9ddb965: Pull complete
1d06a658dbdd: Pull complete
Digest: sha256:8eb99e2169dd5719bc419e852cefdc77ecc86275222fa2258a11cda4ad7a3aac
Status: Downloaded newer image for ghcr.io/codesandbox/devcontainers/typescript-node:latest
root ➜ / $ arch
x86_64
root ➜ / $ curl -fsSL https://docs.grit.io/install | bash
######################################################################## 100.0%##O=# #
grit was installed successfully to ~/.grit/bin/grit
Added "~/.grit/bin" to $PATH in "~/.zshrc"
To get started, run:
exec /bin/zsh
grit --help
root ➜ / $ exec /bin/zsh
root ➜ / $ grit -V
grit 0.1.1
root ➜ / $ cd /srv/src
root ➜ /srv/src $ grit apply 'remove_import(from=`"react"`)'
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/cli-linux-x64
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/workflow_runner-linux-x64
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/marzano-linux-x64
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/gouda-linux-x64
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/timekeeper-linux-x64
./types/global.d.ts
1 import { IAppStore } from '~/store/models/AppStore'
2
3 declare global {
4 namespace NodeJS {
5 interface Global {
# ...
# ...
I've narrowed it down to the image architecture.
I'm on a M1 Mac. I pulled the default Ubuntu image as well as the x64 image:
docker pull ubuntu
docker pull --platform linux/amd64 ubuntu
Then I created a container for both, mounting a directory which I want to run Grit on. After installing and running Grit, if fails on the Arm image, but works on the x64 image.
Arm image ❌
$ docker run -v $(pwd)/src:/srv/src -ti fabf3a8d494905382641dda35544832ec77b90f18b543d0f0b526fb9ed602786 /bin/bash
root@df1279867049:/# apt-get update && apt-get install -y curl && curl -fsSL https://docs.grit.io/install | bash
# ...
root@df1279867049:/# source /root/.bashrc
root@df1279867049:/# grit apply 'remove_import(from=`"react"`)'
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/cli-linux-arm64
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/marzano-linux-arm64
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/timekeeper-linux-arm64
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/gouda-linux-arm64
Error: Invalid grit.yml: patterns[0].samples[1]: missing field `output` at line 22 column 9
root@df1279867049:/#
x64 image ✅
$ docker run -v $(pwd)/src:/srv/src -ti bf3dc08bfed031182827888bb15977e316ad797ee2ccb63b4c7a57fdfe7eb31d /bin/bash # Linux image
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
root@f74db6378f44:/# apt-get update && apt-get install -y curl && curl -fsSL https://docs.grit.io/install | bash
# ...
oot@f74db6378f44:/# grit apply 'remove_import(from=`"react"`)'
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/cli-linux-x64
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/gouda-linux-x64
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/workflow_runner-linux-x64
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/timekeeper-linux-x64
Fetching release URL from: https://api.keygen.sh//v1/accounts/custodian-dev/artifacts/marzano-linux-x64
./srv/src/types/global.d.ts
1 import { IAppStore } from '~/store/models/AppStore'
2
3 declare global {
4 namespace NodeJS {
# ...
Edit: Fixed nomenclature: not "Linux", but x64 rather.
I'm running into this error after a clean install of the Grit CLI: