nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.28k stars 2.32k forks source link

Nx-Plugin is currently not usable #10249

Closed johannesschobel closed 2 years ago

johannesschobel commented 2 years ago

Current Behavior

The nx-plugin package is currently not usable with the latest nx stack. I followed the video tutorial via the official webpage: https://nx.dev/packages/nx-plugin but it fails.

Expected Behavior

It should work ;)

Steps to Reproduce

Follow the tutorial https://nx.dev/packages/nx-plugin

Failure Logs

First, the root property in the generated project.json file is not provided. This causes issues when commiting. Second, adding a new generator fails with:

Cannot find module 'nx/src/generators/utils/json'
Require stack:
- /home/x/projects/prisma-utils/node_modules/@nrwl/devkit/src/generators/format-files.js
- /home/x/projects/prisma-utils/node_modules/@nrwl/devkit/index.js
- /home/x/projects/prisma-utils/node_modules/@nrwl/nx-plugin/src/generators/generator/generator.js
- /home/x/projects/prisma-utils/node_modules/nx/src/config/workspaces.js
- /home/x/projects/prisma-utils/node_modules/nx/src/command-line/generate.js
- /home/x/projects/prisma-utils/node_modules/nx/src/command-line/nx-commands.js
- /home/x/projects/prisma-utils/node_modules/nx/bin/init-local.js
- /home/x/projects/prisma-utils/node_modules/nx/bin/nx.js
- /usr/lib/node_modules/nx/bin/nx.js

Environment

 >  NX   Report complete - copy this into the issue template

   Node : 14.16.1
   OS   : linux x64
   npm  : 8.5.5

   nx : 13.10.3
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.1.4
   @nrwl/eslint-plugin-nx : 13.10.3
   @nrwl/express : Not Found
   @nrwl/jest : 13.10.3
   @nrwl/js : 14.1.4
   @nrwl/linter : 13.10.3
   @nrwl/nest : 13.10.3
   @nrwl/next : Not Found
   @nrwl/node : 13.10.3
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : 14.1.4
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 13.10.3
   typescript : 4.6.3
   rxjs : 7.5.5
   ---------------------------------------
   Community plugins:
         @ng-easy/builders: 7.1.0
AgentEnder commented 2 years ago

Hey @johannesschobel , it may be unrelated, but some of your @nrwl/* packages don't line up with the version of nx you have installed. Aside from @nrwl/nx-cloud, all packages under the nrwl scope should generally be set up with the same version.

Can you correct this and check that the issue still reproduces? An easy way to fix this would be to run nx migrate {v}, where v is the version of nx you have installed. Alternatively, updating to latest with nx migrate latest would also work.

AgentEnder commented 2 years ago

Since you said you followed the video, I'm going to assume you used npx create-nx-plugin or npx create-nx-workspace, you should add @latest to either package name if you want the latest, otherwise npx may cache an older version.

johannesschobel commented 2 years ago

I am sorry, i feel so stupid.. yeah, there was an issue with the @nrwl/* package version. I updated to latest via nx migrate latest, ran npm install and nx migrate --run-migrations and retried. Works like a charm!

sorry for bothering you! All the best and thanks for helping out!

github-actions[bot] commented 1 year ago

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.