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

[BUG] Cannot find module '@nrwl/js/src/generators/library/library' #490

Closed
devklick opened this issue Aug 14, 2022 · 8 comments
Closed

[BUG] Cannot find module '@nrwl/js/src/generators/library/library' #490

devklick opened this issue Aug 14, 2022 · 8 comments
Assignees
Labels
bug Something isn't working outdated scope: core

Comments

@devklick
Copy link
Contributor

devklick commented Aug 14, 2022

Describe the bug
When trying to create a new dotnet app in an empty nx workspace, I get the error:

Cannot find module '@nrwl/js/src/generators/library/library'

To Reproduce

  1. Create the nx workspace:
npx create-nx-workspace@latest
  1. Select the apps option for the type of workspace to create
  2. Install the nx dotnet plugin
npm i --save-dev @nx-dotnet/core
  1. Use the nx dotnet plugin to generate a dotnet application
npx nx g @nx-dotnet/core:app my-app --test-template xunit --language C#
  1. Select any naming convention#
  2. Error is thrown

Expected behavior
The C# application my-app should be created successfully

Screenshots
If applicable, add screenshots to help explain your problem.

Environment:

  • OS: Zorin 16.1
  • Browser N/A
  • Version latest (1.13.0])
  • Affected Packages: @nx-dotnet/core
  • Node version: v18.0.0
  • npm version: 8.6.0

Additional context

  • The same error is thrown regardless which options I select (test template, language, folder names)
  • The same error is thrown when using npx to invoke nx and when nx installed as a project dependency (dev or otherwise)
  • Verbose logging output
>  NX  Generating @nx-dotnet/core:application

✔ Which path naming conventions should the project use? · nx

 >  NX   Cannot find module '@nrwl/js/src/generators/library/library'

   Require stack:
   - /home/user/repos/example-nx/node_modules/@nx-dotnet/core/src/generators/add-swagger-target/add-swagger-target.js
   - /home/user/repos/example-nx/node_modules/@nx-dotnet/core/src/generators/utils/generate-project.js
   - /home/user/repos/example-nx/node_modules/@nx-dotnet/core/src/generators/app/generator.js
   - /home/user/repos/example-nx/node_modules/nx/src/config/workspaces.js
   - /home/user/repos/example-nx/node_modules/nx/src/config/configuration.js
   - /home/user/repos/example-nx/node_modules/nx/src/command-line/generate.js
   - /home/user/repos/example-nx/node_modules/nx/src/command-line/nx-commands.js
   - /home/user/repos/example-nx/node_modules/nx/bin/init-local.js
   - /home/user/repos/example-nx/node_modules/nx/bin/nx.js

Error: Cannot find module '@nrwl/js/src/generators/library/library'
Require stack:
- /home/user/repos/example-nx/node_modules/@nx-dotnet/core/src/generators/add-swagger-target/add-swagger-target.js
- /home/user/repos/example-nx/node_modules/@nx-dotnet/core/src/generators/utils/generate-project.js
- /home/user/repos/example-nx/node_modules/@nx-dotnet/core/src/generators/app/generator.js
- /home/user/repos/example-nx/node_modules/nx/src/config/workspaces.js
- /home/user/repos/example-nx/node_modules/nx/src/config/configuration.js
- /home/user/repos/example-nx/node_modules/nx/src/command-line/generate.js
- /home/user/repos/example-nx/node_modules/nx/src/command-line/nx-commands.js
- /home/user/repos/example-nx/node_modules/nx/bin/init-local.js
- /home/user/repos/example-nx/node_modules/nx/bin/nx.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
    at Module._load (node:internal/modules/cjs/loader:780:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (/home/user/repos/example-nx/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/home/user/repos/example-nx/node_modules/@nx-dotnet/core/src/generators/add-swagger-target/add-swagger-target.js:5:19)
    at Module._compile (/home/user/repos/example-nx/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
@devklick devklick added bug Something isn't working needs-triage This issue has yet to be looked over by a core team member labels Aug 14, 2022
@AgentEnder
Copy link
Member

Hey @devklick , can you run nx report and include the output?

@devklick
Copy link
Contributor Author

devklick commented Aug 15, 2022

HI @AgentEnder , see output below

❯ npx nx report

 >  NX   Report complete - copy this into the issue template

   Node : 18.0.0
   OS   : linux x64
   npm  : 8.6.0
   
   nx : 14.5.6
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.5.6
   @nrwl/eslint-plugin-nx : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 14.5.6
   @nrwl/js : Not Found
   @nrwl/linter : 14.5.6
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 14.5.6
   typescript : 4.7.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:
         @nx-dotnet/core: 1.13.0

Edit: Presumably the fact that @nrwl/js is not found is the reason I'm getting this error. This is likely because I'm working with a blank workspace (the nx apps template).

@devklick
Copy link
Contributor Author

I've now installed the @nrwl/js plugin and ran the npx nx g @nx-dotnet/core:app generator again and it worked! Which is great.

I think it might be worth adding this to the list of prerequisites in the readme.

@AgentEnder
Copy link
Member

Yeah, this was already fixed but I had evidently not released it 😓. I'm pushing the release now. You can see the PR here: #484

I'm going to go ahead and merge your PR too, since it doesn't hurt to mention it.

@devklick
Copy link
Contributor Author

devklick commented Nov 9, 2022

@AgentEnder Did this change ever get released? I see the PR was merged, however I've ran into the same issue again today when starting a new workspace.

The nx-dotnet version I'm using is the latest, 1.16.0. Again, manually installing @nrwl/js fixed the problem, but just wanted to feed this back as it seems like your PR linked above was meant to automatically install this dependency.

Nx report
   Node : 18.0.0
   OS   : linux x64
   npm  : 8.6.0
   
   nx : 14.8.6
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.8.6
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : Not Found
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 14.8.6
   @nrwl/js : Not Found
   @nrwl/linter : 14.8.6
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/rollup : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/webpack : Not Found
   @nrwl/workspace : 14.8.6
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:
         @nx-dotnet/core: 1.16.0

@AgentEnder
Copy link
Member

Interesting! I may have missed something on this one. I'll reopen it, its possible the tests pull from the parent repo's module as a fallback during module resolution.

@AgentEnder AgentEnder reopened this Nov 11, 2022
@AgentEnder AgentEnder removed the needs-triage This issue has yet to be looked over by a core team member label Nov 11, 2022
@AgentEnder AgentEnder self-assigned this Nov 11, 2022
@AgentEnder
Copy link
Member

I think this is working properly now.

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working outdated scope: core
Projects
None yet
Development

No branches or pull requests

2 participants