Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot migrate from 11.6.3 to 12 #5923

Closed
mehrad-rafigh opened this issue Jun 8, 2021 · 7 comments
Closed

Cannot migrate from 11.6.3 to 12 #5923

mehrad-rafigh opened this issue Jun 8, 2021 · 7 comments

Comments

@mehrad-rafigh
Copy link
Contributor

Current Behavior

I cannot migrate my workspace from nx 11.6.3 to 12. Running the migrations I get the following error

>  NX  Running migrations from 'migrations.json'

Running migration update-ngcc-postinstall
Successfully finished update-ngcc-postinstall
---------------------------------------------------------
Running migration update-webpack-browser-config
Successfully finished update-webpack-browser-config
---------------------------------------------------------
Running migration update-storybook
Successfully finished update-storybook
---------------------------------------------------------
Running migration update-angular-eslint-rules
Successfully finished update-angular-eslint-rules
---------------------------------------------------------
Running migration convert-webpack-browser-build-target-to-delegate-build
Successfully finished convert-webpack-browser-build-target-to-delegate-build
---------------------------------------------------------
Running migration update-angular-config-v12
Cannot read property 'startsWith' of undefined

Alan from the Angular CLI Team answered my unrelated question in this issue.
angular/angular-cli#21075 (comment)

Our libraries do not have a builder property.

Expected Behavior

I can migrate to nx 12

Environment

>  NX  Report complete - copy this into the issue template

  Node : 14.15.5
  OS   : linux x64
  npm  : 6.14.13
  
  nx : Not Found
  @nrwl/angular : 12.3.6
  @nrwl/cli : 12.3.6
  @nrwl/cypress : 12.3.6
  @nrwl/devkit : 12.3.6
  @nrwl/eslint-plugin-nx : 12.3.6
  @nrwl/express : 12.3.6
  @nrwl/jest : 12.3.6
  @nrwl/linter : 12.3.6
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : 12.3.6
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.3.6
  @nrwl/web : Not Found
  @nrwl/workspace : 12.3.6
  @nrwl/storybook : 12.3.6
  @nrwl/gatsby : Not Found
  typescript : 4.2.4

@leosvelperez
Copy link
Member

Thanks for reporting this!

Please make sure all your targets for a project have a builder which is a required property. Targets are the specification of something that can be run in a project, and the builder specifies the function that will be run when the target is invoked. Without the builder, there's no way to know what to do when invoking the target. If you currently have targets without a builder, that means those targets are not being used and most likely, they are not needed or you need to add their builder property to make them usable.

I'm closing this one since it's a duplicate of #5655.

@mehrad-rafigh
Copy link
Contributor Author

Hi @leosvelperez the only project that do not have a builder target are our libraries.
Those are used by the apps and thus do not have any builders. What is the way to migrate them?

@leosvelperez
Copy link
Member

leosvelperez commented Jun 8, 2021

Can you provide the project definition of any of those libraries?

Libraries are not special when it comes to targets having a builder or not. All types of projects must have a builder in their targets, otherwise, the target is invalid. As I said in the above comment, if you don't have a builder in a target, you don't need the target then, it's definitely not being used.

@mehrad-rafigh
Copy link
Contributor Author

One example for a library definition would be the following

    "job-scheduler-modals": {
      "projectType": "library",
      "root": "libs/job-scheduler/modals",
      "sourceRoot": "libs/job-scheduler/modals/src",
      "prefix": "cg",
      "architect": {
        "lint": {
          "builder": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": [
              "libs/job-scheduler/modals/src/**/*.ts",
              "libs/job-scheduler/modals/src/**/*.html"
            ]
          }
        },
        "test": {
          "builder": "@nrwl/jest:jest",
          "outputs": [
            "coverage/libs/job-scheduler/modals"
          ],
          "options": {
            "jestConfig": "libs/job-scheduler/modals/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    }

Those libs are consumed by other libraries and the composite library is then consumed by an app.
We generate everything with the ng command, so I am a bit baffled why the builder property is missing.

@leosvelperez
Copy link
Member

@mehrad-rafigh all targets in that project (lint and test) have a builder property. That project has all its targets correctly configured. I think you might be confusing the builder property with having a target named build, that's a different thing and having a specific target like that one is not a requirement. You need to check your projects' targets (objects inside architect) and see which one doesn't have a builder property defined inside.

@mehrad-rafigh
Copy link
Contributor Author

mehrad-rafigh commented Jun 9, 2021

Thanks @leosvelperez that clears a big question mark in my head. I will take a look which one of the projects do not a have a builder property

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants