nx: Unable to determine 'tsconfig.json' file in workspace config.

Current Behavior

I just ran nx migrate --run-migrations

(I had just previously run nx migrate latest && npm i && nx migrate --run-migrations but it was missing a couple of dependencies –

  • @angular-devkit/schematics and
  • @schematics/angular/utility/change

I installed those and came back to run migrations.)

However under

Running migration migration-v13

For every many of my projects it said it was skipping them. For example

Skipping migration for project shared-util. Unable to determine 'tsconfig.json' file in workspace config.

Expected Behavior

Migrations works for every project

Steps to Reproduce

I’m guessing this is specific to my workspace so apart from the steps above I don’t think I can create something that will reproduce the error.

Failure Logs

I’m not sure what I could provide more than what I have.

Environment

Node : 14.17.1 OS : darwin x64 npm : 7.20.0

nx : 13.8.7 @nrwl/angular : 13.8.7 @nrwl/cli : 13.8.7 @nrwl/cypress : 13.8.7 @nrwl/detox : undefined @nrwl/devkit : 13.8.7 @nrwl/eslint-plugin-nx : 13.8.7 @nrwl/express : undefined @nrwl/jest : 13.8.7 @nrwl/js : undefined @nrwl/linter : 13.8.7 @nrwl/nest : undefined @nrwl/next : undefined @nrwl/node : undefined @nrwl/nx-cloud : undefined @nrwl/react : undefined @nrwl/react-native : undefined @nrwl/schematics : undefined @nrwl/storybook : 13.8.7 @nrwl/tao : 13.8.7 @nrwl/web : undefined @nrwl/workspace : 13.8.7 typescript : 4.5.5 rxjs : 6.6.7


Community plugins: @angular-material-extensions/password-strength: 8.2.1 @angular/animations: 13.2.6 @angular/cdk: 13.2.6 @angular/common: 13.2.6 @angular/compiler: 13.2.6 @angular/core: 13.2.6 @angular/fire: 7.1.1 @angular/forms: 13.2.6 @angular/material: 13.2.6 @angular/material-luxon-adapter: 13.0.2 @angular/material-moment-adapter: 13.1.1 @angular/platform-browser: 13.2.6 @angular/platform-browser-dynamic: 13.2.6 @angular/router: 13.2.6 @ngrx/component-store: 13.0.2 @ngrx/effects: 13.0.2 @ngrx/entity: 13.0.2 @ngrx/router-store: 13.0.2 @ngrx/store: 13.0.2 @angular-devkit/build-angular: 13.2.6 @angular/compiler-cli: 13.2.6 @angular/language-service: 13.2.6 @ngrx/schematics: 13.0.2 @ngrx/store-devtools: 13.0.2

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 27 (5 by maintainers)

Most upvoted comments

I have just carried out a migration from 14.2 to latest on an nx angular project and am observing the following:

  • my project’s libraries were all generated with the nx-webstorm plugin and are all non-buildable.
  • none of the libraries have any reference to a tsconfig.json file in their respective project.json files
  • When I run nx migrate --run-migrations some of my libraries get updated but some do not and the logger prints Unable to determine 'tsconfig.json' file in workspace config.
  • However when I look at the changes made to the files by the migration, some of the modules that were flagged as skipped have actually been modified

I am at a bit of a loss as to how to get confidence that the migrations have fully run as expected. Any guidance would be much appreciated.

Why is this closed? It doesn’t seem like the issue was ever resolved, based on these last few posts.

@prateek-giddh I can think of two possibilities: 1- one of your projects/libraries doesn’t have the architect properties, even if you don’t need it just add it as empty object "architect": {}, 2- you didn’t specified the builder for your target (the test in your case), for example I use “@nrwl/jest:jest” builder

"test": {
          "builder": "@nrwl/jest:jest",
          "outputs": ["coverage/libs/dir/lib1"],
          "options": {
            "tsConfig": "libs/dir/lib1/tsconfig.lib.json",
            "jestConfig": "libs/dir/lib1/jest.config.js",
            "passWithNoTests": true
          }
        },

@prateek-giddh

"my-lib": {
 ...
  "architect": {
    "build": {
        "options": {
           "tsConfig": "path/to/your/tsconfig.lib.json",
         }
    },
 ...
},

In case the library is not buildable

"my-lib": {
 ...
  "architect": {
    "test": {
        "options": {
           "tsConfig": "path/to/your/tsconfig.lib.json",
         }
    },
  ...
},

@AgentEnder thanks, adding the “tsConfig” to the test target works perfectly.

I think it looks at the test target as well, so you can try adding it there. It’s pretty silly that it’s required at all IMHO, but I know that’s the fix for angular material. I think the main angular packages are similar.

Ok, I figured out that where I have to add that extra tsConfig:

    "build": {
      "executor": "@nrwl/angular:package",
      "outputs": ["dist/libs/core/error"],
      "options": {
=>      "tsConfig": "libs/core/error/tsconfig.lib.json",
        "project": "libs/core/error/ng-package.json"
      },
      "configurations": {
        "production": {
          "tsConfig": "libs/core/error/tsconfig.lib.prod.json"
        },
        "development": {
          "tsConfig": "libs/core/error/tsconfig.lib.json"
        }
      },
      "defaultConfiguration": "production"
    },

Is there an easy way to do it for all the libs in a workspace?

Is there some setting, so that newly generated projects have this already included?

Or is there any other fix I can use?

Thank you!

I only had problems with the migrations of Angular/Material and CDK. The migrations of the main angular packages (core etc.) worked fine.