Gitlab CI fails but locally it works

Hi,

I’m using the Gitlab pipe to build a node server. It all worked fine but with the latest code changes its not working anymore. Locally running the same commands as in the gitlab-ci.yml all works perfectly.

Gitlab Error:

> backend@1.0.0 tsc
> tsc
models/Agenda/agenda.validator.ts(127,77): error TS2694: Namespace '"*"' has no exported member 'ValidateFunction'.

models/Agenda/agenda.validator.ts

export type ValidateFunction<T> = ((data: unknown) => data is T) & Pick<Ajv.ValidateFunction, 'errors'>
export const isIAgenda = ajv.compile(IAgendaSchema) as ValidateFunction<IAgenda>;
export default function validate(value: unknown): IAgenda {
  if (isIAgenda(value)) {
    return value;
  } else {
    throw new Error(
      ajv.errorsText(isIAgenda.errors!.filter((e: any) => e.keyword !== 'if'), {dataVar: 'IAgenda'}) +
      '\n\n' +
      inspect(value),
    );
  }
}

The file was generated by this tool .

gitlab-ci.yml

build:
  stage: build
  script:
    - (cd backend && npm ci --cache .npm --prefer-offline && npm run tsc)
    - mkdir -p dist
    - cp -r backend dist/backend
    - cp web/cms.zip dist/cms.zip
  artifacts:
    paths:
      - dist
      - web/app

Using gitlab.com

Hi @fuchsjon

My guess would be that you may have something in your local environment that you don’t have in the GitLab runner. It might be worth checking your $PATH variables both locally and in the pipeline, and looking for any other env vars that you might have set locally.

The other thing you might want to look for, is whether you have the same versions of node and npm in both places.