TypeStrong / fork-ts-checker-webpack-plugin

Webpack plugin that runs typescript type checker on a separate process.
MIT License
1.96k stars 239 forks source link

Github Actions module 'Ajv' not found #824

Closed Maddrobots closed 1 year ago

Maddrobots commented 1 year ago

Current behavior

I am developing a TypeScript project on macos and it successfully compiles (tsc) locally but when the following github actions script is run:

build:
    needs: lint
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Use Node.js 20.x
      uses: actions/setup-node@v3
      with:
        node-version: 20.x
        cache: 'npm'
    - run: npm ci
    - run: npm run compile

it fails with the output:

Run npm run compile

> hello_world@1.0.0 compile
> tsc

Error: src/common/validation.ts(1,3[4](https://github.com/{redacted}/job/17324159764#step:6:5)): error TS230[7](https://github.com/{redacted}/job/17324159764#step:6:8): Cannot find module 'Ajv' or its corresponding type declarations.
Error: Process completed with exit code 2.

(* I 'redacted' my project info)

my package.json:

{
  "name": "hello_world",
  "version": "1.0.0",
  "description": "hello world sample for NodeJS",
  "main": "app.js",
  "repository": "https://github.com/awslabs/aws-sam-cli/tree/develop/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs",
  "author": "SAM CLI",
  "license": "MIT",
  "scripts": {
    "unit": "jest",
    "lint": "eslint 'src/**/*.ts' --quiet",
    "lint-warn": "eslint 'src/**/*.ts'",
    "lint-fix": "eslint 'src/**/*.ts' --quiet --fix",
    "compile": "tsc",
    "test": "npm run compile && npm run unit"
  },
  "dependencies": {
    "@aws-sdk/client-secrets-manager": "^3.254.0",
    "@hapi/joi": "^17.1.1",
    "ajv": "^8.12.0",
    "esbuild": "^0.14.14",
    "jwks-rsa": "^3.0.1",
    "jwt-decode": "^3.1.2",
    "lodash": "^4.17.21",
    "mongoose": "^6.11.2"
  },
  "devDependencies": {
    "@types/aws-lambda": "^8.10.92",
    "@types/hapi__joi": "^17.1.9",
    "@types/jest": "^29.2.0",
    "@types/lodash": "^4.14.195",
    "@types/node": "^18.11.4",
    "@typescript-eslint/eslint-plugin": "^5.10.2",
    "@typescript-eslint/parser": "^5.10.2",
    "esbuild-jest": "^0.5.0",
    "eslint": "^8.8.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "jest": "^29.2.1",
    "prettier": "^2.5.1",
    "ts-node": "^10.9.1",
    "typescript": "^4.8.4"
  }
}

I have tried switching the runner os to 'macos-latest' to match my local environment but it gives the same result. The only thing I can think of is something I have installed locally that the runner needs but 'ajv' is in the list of dependencies so it should be installed by the 'npm ci' step of the githb action script. Any help is greatly appreciated!

Expected behavior

github actions runner succeeds just like running the script locally.

Steps to reproduce the issue

  1. run the above github actions script with a TypeScript project that has ajv as a dependency

Environment

Maddrobots commented 1 year ago

Wrong repo, my apologies