eslintts-jestnx-monorepo

Issues in running lint and jest tests on a fresh nx workspace


npx create-nx-workspace --pm pnpm

nx generate @nx/js:lib utils --directory=libs

nx lint utils
Error: The externalDependency 'eslint' for 'utils:lint' could not be found

nx test utils
Error: The externalDependency 'jest' for 'utils:test' could not be found

Here is what my package.json looks like

{
  "name": "@simple-nx-workspace/source",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": { },
  "private": true,
  "dependencies": {
    "tslib": "^2.3.0"
  },
  "devDependencies": {
    "@nx/eslint": "19.0.1",
    "@nx/eslint-plugin": "19.0.1",
    "@nx/jest": "19.0.1",
    "@nx/js": "19.0.1",
    "@nx/workspace": "19.0.1",
    "@swc-node/register": "~1.8.0",
    "@swc/core": "~1.3.85",
    "@swc/helpers": "~0.5.2",
    "@types/jest": "^29.4.0",
    "@types/node": "18.16.9",
    "@typescript-eslint/eslint-plugin": "^7.3.0",
    "@typescript-eslint/parser": "^7.3.0",
    "eslint": "~8.57.0",
    "eslint-config-prettier": "^9.0.0",
    "jest": "^29.4.1",
    "jest-environment-node": "^29.4.1",
    "nx": "19.0.1",
    "prettier": "^2.6.2",
    "ts-jest": "^29.1.0",
    "ts-node": "10.9.1",
    "typescript": "~5.4.2"
  }
}

Tried reinstalling dependencies but did not help. Ideally would want to avoid installing global dependencies. Any feedback around what might be the issue?


Solution

  • Downgrading my pnpm version to 8.5.1 fixed this.