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

Error when generating a new app with @ng-rspack/nx:app #31

Open
eilensm opened this issue Dec 29, 2024 · 6 comments
Open

Error when generating a new app with @ng-rspack/nx:app #31

eilensm opened this issue Dec 29, 2024 · 6 comments

Comments

@eilensm
Copy link

eilensm commented Dec 29, 2024

when executing the command to generate a new app, I get an error (see below). I'm running Windows 64-bit and have the version 0.0.35 of @ng-rspack/nx installed.

$ npx nx g @ng-rspack/nx:app apps/myapp --verbose

 NX   Unable to resolve @ng-rspack/nx:app.

Cannot find module './src/generators/application/schema.json'
Require stack:
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\config\schema-utils.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\command-line\run\executor-utils.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\devkit-internals.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\utils\assert-workspace-validity.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\project-graph\build-project-graph.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\project-graph\project-graph.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\project-graph\file-utils.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\utils\package-manager.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\utils\package-json.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\bin\nx.js
Error: Unable to resolve @ng-rspack/nx:app.
Cannot find module './src/generators/application/schema.json'
Require stack:
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\config\schema-utils.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\command-line\run\executor-utils.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\devkit-internals.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\utils\assert-workspace-validity.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\project-graph\build-project-graph.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\project-graph\project-graph.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\project-graph\file-utils.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\utils\package-manager.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\utils\package-json.js
- C:\workspaces\rspack\ng-rspack-test\node_modules\nx\bin\nx.js
    at getGeneratorInformation (C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\command-line\generate\generator-utils.js:40:15)
    at C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\command-line\generate\generate.js:216:248
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async handleErrors (C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\utils\handle-errors.js:8:24)
    at async Object.handler (C:\workspaces\rspack\ng-rspack-test\node_modules\nx\src\command-line\generate\command-object.js:13:22)
@dirk122119
Copy link

I also run into this error, Do you have any resolution?

@eilensm
Copy link
Author

eilensm commented Jan 7, 2025

No. But didn't try it out lately since I switched to rsbuild which was quite easy to integrate in my current app.

@skoblenick
Copy link

@skoblenick
Copy link

skoblenick commented Jan 8, 2025

looking at the src in the node_modules directory, the schemaPath arg is being set relative to ./src/generators/application/schema.json and later it's being joined with <working_dir>/node_modules/@ng-rspack/nx but there is no src directory within the node_module

@skoblenick
Copy link

if I pull the schema.json from the nx-plugin src into the expected path, the generator will run but fails cause the path to the "./src/generators/application/application" isn't correct and is in the dist folder.

FYI: this issue also happens with the host and and remote generators as well

@dennisroche
Copy link

In 59daf98 the packages/nx-plugin/project.json build targets were changed to not include the src/ folder removing:

"build": {
      "executor": "@nx/js:swc",
      "outputs": ["{options.outputPath}"],
      "options": {
        "outputPath": "dist/packages/nx",
        "main": "packages/nx-plugin/src/index.ts",
        "tsConfig": "packages/nx-plugin/tsconfig.lib.json",
        "assets": [
          "packages/nx-plugin/*.md",
          {
            "input": "./packages/nx-plugin/src",
            "glob": "**/!(*.ts)",
            "output": "./src"
          },
          {
            "input": "./packages/nx-plugin/src",
            "glob": "**/*.d.ts",
            "output": "./src"
          },
          {
            "input": "./packages/nx-plugin",
            "glob": "generators.json",
            "output": "."
          },
          {
            "input": "./packages/nx-plugin",
            "glob": "executors.json",
            "output": "."
          }
        ]
      }
    },

This was part of feat(build): add rsbuild plugin so likely intentional but it might need some changes to the parent build to still include the schema.json files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants