Open Closed

Angular Code Generation for 5.3.4 Project Fails with "Cannot find module...run-schematics.mjs" after v6.0.0 release #3822


User avatar
0
jeflux created
  • ABP Framework version: v5.3.4
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"
  • Start with a working 5.3.4 Module Template Solution
  • Generate Angular CRUD code, as needed
  • ABP Releases v6.0.0
  • Code Generation no longer works

We have multiple Modules for our microservices solution. Early this week, we were generating backend as UI code as we develop. Yesterday, we were unable to generate backend code. We found a slight workaround, which is in ticket here: https://support.abp.io/QA/Questions/3813/Version-Issues-Missing-Templates-with-ABP-Suite-after-upgrading-after-release-of-600

Today, I'm now trying to add CRUD UI elements in Angular. ABP Suite says "Completed" but no code is generated. See stacktrace in above image. My coworker was working on an entirely separate module and had the identical error today.

I tried a few things, including deleting the .suite, node_modules, and yarn.lock files/folders from the Angular app. I ran yarn commands. When I ran the Suite code gen task again, the .suite folder was re-added, but error was same.

I then noticed that package.json file in .suite/schematics folder had what appeared to be "old" values. They were:

{ "name": "@volo/abp.ng.suite", "version": "4.4.0-rc.2", "private": true, "description": "Schematics that works with ABP Suite", "keywords": [ "schematics" ], "schematics": "./collection.json", "dependencies": { "@abp/ng.schematics": "~4.4.0-rc.2", "@angular-devkit/core": "~11.0.2", "@angular-devkit/schematics": "~11.0.2", "jsonc-parser": "^2.3.0", "typescript": "~3.9.2" }, "devDependencies": { "@angular/cli": "~11.0.2", "@schematics/angular": "~11.0.2", "@types/node": "^12.11.1" }, "peerDependencies": { "@types/jest": "^26.0.0", "jest": "^26.0.0", "jest-preset-angular": "^8.2.0" } }

So I replaced them with the "correct" values which I copied from another 5.3.4 project we have that hasn't been touched since the v6.0.0 release. They are:

{ "name": "@volo/abp.ng.suite", "version": "5.3.4", "private": true, "description": "Schematics that works with ABP Suite", "keywords": [ "schematics" ], "schematics": "./collection.json", "dependencies": { "@abp/ng.schematics": "~5.3.4", "@angular-devkit/core": "~11.0.2", "@angular-devkit/schematics": "~11.0.2", "execa": "^6.1.0", "jsonc-parser": "^2.3.0", "path": "^0.12.7", "prettier": "^2.3.2", "typescript": "~3.9.2" }, "devDependencies": { "@angular/cli": "~11.0.2", "@schematics/angular": "~11.0.2", "@types/node": "^12.11.1" }, "peerDependencies": { "@types/jest": "^26.0.0", "jest": "^26.0.0", "jest-preset-angular": "^8.2.0" } }

I then delete the package-lock.json file and node_modules folder from the .suite/schematics folder and then ran an npm install.

Next I tried the code gen from Suite again. It failed, but with the error message:

An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID

I've seen that before! So I manually added the $ symbol in .suite/schematics/commands/entity/schema.json.

I then ran the code gen again from Suite and it worked!

At this point it looks like I've managed to unblock myself, but something is definitely not right. I'll also need to walk my colleagues through this process so they can be unblocked on their work.


6 Answer(s)
  • User Avatar
    0
    malik.masis created

    Hello,

    Sorry for the late answer. The team couldn't reproduce the issue. Does continue the same problem, if yes could you give us more detail, please?

    Regards.

  • User Avatar
    0
    jeflux created

    We updated our entire solution to 6.0.1 and still have the issue. Note that we are using "Module Template"

    My current CLI and Suite versions are 6.0.2, We can do backend code generation without any issues. This week I scaffolded a new entity for the backend, but today I'm trying to generate the CRUID Angular UI and I get the same error:

    Cannot find module 'C:\company\Solution.Main\Blurg\angular.suite\schematics\run-schematics.mjs'

    I then fully deleted CLI/Suite, deleted .abp folder and reinstalled everything. Same result.

    I then created a new solution with the "Module Template". This resulted in the download of supporting files:

    However, when attempting to generate the CRUD Angular UI for this brand new 6.0.2 Module Template solution, same error.

  • User Avatar
    0
    jeflux created

    I do want to add that the work around noted in my original post still works:

    1. Manually add the run-schematics.mjs file to .suite\schematics folder in Angular project
    2. Update the package.json file in .suite\schematics with the JSON provided above
    3. Runnpm install in the .suite\schematics folder
    4. Manually add the $ character as-needed to the schema.json files.
    5. Then run the code generation from ABP Suite
  • User Avatar
    0
    muhammedaltug created

    Hello,

    I created a project with ABP Suite in version 6.0.2. And I created an entity with CRUD Page generator. There was no error.

    Can you send the project with created in 6.0.2 version via email? Please don't apply workarounds. Please don't upload public platforms.

  • User Avatar
    0
    jeflux created

    Hello,

    I created a project with ABP Suite in version 6.0.2. And I created an entity with CRUD Page generator. There was no error.

    Can you send the project with created in 6.0.2 version via email? Please don't apply workarounds. Please don't upload public platforms.

    I created multiple projects last week and none of them worked when trying to generate Angular code. I tried generating code for our existing projects, none of it worked.

    But yesterday I generated a new project to provide the information requested (without applying workarounds) and ABP Suite kicked off a new download of packages. And now it all works. It appears generating Angular code for my existing project now works also.

    My two colleagues and I have been fighting this for 2 months. Was there an update to ABP Suite published on or after Dec 14?

  • User Avatar
    0
    alper created
    Support Team Director

    there was an update on ABP Suite. those who have this issue must re-install the ABP Suite.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11