1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Angular NX workspace: getting error "Required property 'main' is missing

Discussão em 'Angular' iniciado por John Davis, Junho 22, 2025.

  1. John Davis

    John Davis Guest

    I have a project that's being split apart using nx workspaces. Some of the workspaces give the error:

    Required property 'main' is missing


    when running the nx test command, and some don't. There seems to be nothing that would cause this in nx.json. Here is the relevant content of my angular.json:

    {
    "version": 1,
    "cli": {
    "defaultCollection": "@nrwl/angular",
    "analytics": false
    },
    "schematics": {
    "@nrwl/angular": {
    "application": {
    "linter": "eslint"
    },
    "library": {
    "linter": "eslint"
    },
    "storybook-configuration": {
    "linter": "eslint"
    }
    },
    "@nrwl/angular:application": {
    "style": "scss",
    "linter": "eslint",
    "unitTestRunner": "jest",
    "e2eTestRunner": "cypress"
    },
    "@nrwl/angular:library": {
    "style": "scss",
    "linter": "eslint",
    "unitTestRunner": "jest"
    },
    "@nrwl/angular:component": {
    "style": "scss"
    }
    },
    "newProjectRoot": "apps",
    "projects": {
    "pricing": {
    "projectType": "application",
    "root": "apps/pricing",
    "sourceRoot": "apps/pricing/src",
    "prefix": "trade-ops",
    "architect": {
    "build": {
    "builder": "ngx-build-plus:browser",
    "options": {
    "outputPath": "dist/apps/pricing",
    "index": "apps/pricing/src/index.html",
    "main": "apps/pricing/src/main.ts",
    "polyfills": "apps/pricing/src/polyfills.ts",
    "tsConfig": "apps/pricing/tsconfig.app.json",
    "aot": true,
    "assets": [
    {
    "glob": "*",
    "input": "libs/gav-shared/Assets/Icons/",
    "output": "assets/"
    },
    "apps/pricing/src/assets"
    ],
    "styles": ["apps/pricing/src/styles.scss"],
    "scripts": []
    },
    "configurations": {
    "production": {
    "optimization": true,
    "outputHashing": "none",
    "sourceMap": false,
    "namedChunks": false,
    "extractLicenses": true,
    "vendorChunk": false,
    "buildOptimizer": true,
    "budgets": [
    {
    "type": "initial",
    "maximumWarning": "10mb",
    "maximumError": "25mb"
    },
    {
    "type": "anyComponentStyle",
    "maximumWarning": "6kb",
    "maximumError": "10kb"
    }
    ]
    }
    }
    },
    "serve": {
    "builder": "ngx-build-plus:dev-server",
    "options": {
    "browserTarget": "pricing:build"
    },
    "configurations": {
    "production": {
    "browserTarget": "pricing:build:production"
    }
    }
    },
    "extract-i18n": {
    "builder": "@angular-devkit/build-angular:extract-i18n",
    "options": {
    "browserTarget": "pricing:build"
    }
    },
    "lint": {
    "builder": "@nrwl/linter:eslint",
    "options": {
    "lintFilePatterns": [
    "apps/pricing/src/**/*.ts",
    "apps/pricing/src/**/*.html"
    ]
    }
    },
    "test": {
    "builder": "ngx-build-plus:karma",
    "outputs": ["coverage/apps/pricing"],
    "options": {
    "jestConfig": "apps/pricing/jest.config.js",
    "passWithNoTests": true
    }
    }
    }
    },
    "pricing-e2e": {
    "root": "apps/pricing-e2e",
    "sourceRoot": "apps/pricing-e2e/src",
    "projectType": "application",
    "architect": {
    "e2e": {
    "builder": "@nrwl/cypress:cypress",
    "options": {
    "cypressConfig": "apps/pricing-e2e/cypress.json",
    "tsConfig": "apps/pricing-e2e/tsconfig.e2e.json",
    "devServerTarget": "pricing:serve"
    },
    "configurations": {
    "production": {
    "devServerTarget": "pricing:serve:production"
    }
    }
    },
    "lint": {
    "builder": "@nrwl/linter:eslint",
    "options": {
    "lintFilePatterns": ["apps/pricing-e2e/**/*.{js,ts}"]
    }
    }
    }
    },
    // Other projects...
    },
    "defaultProject": "trade-operations"
    }


    It also gives this error when running "nx test" (on the default project).

    Continue reading...

Compartilhe esta Página