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] createNodesFor is not a function since @nxrocks/nx-spring-boot 9.3.0 #214

Closed
batnyu opened this issue Feb 19, 2024 · 8 comments
Closed

Comments

@batnyu
Copy link

batnyu commented Feb 19, 2024

Plugin Name

@nxrocks/nx-spring-boot

Nx Report

NX (0 , common_jvm_1.createNodesFor) is not a function

Expected Behaviour

Project Graph generation to v2 API should work

Actual Behaviour

We receive the following error :
NX (0 , common_jvm_1.createNodesFor) is not a function

Steps to reproduce the behaviour

  1. Install @nxrocks/nx-spring-boot 9.3.0
  2. Run "nx report" or a build
@tinesoft
Copy link
Owner

Hi @batnyu

Thanks for using the plugin and for reporting this.

The signature of createNodesFor method (from common-jvm) has changed in the latest version.
But that should be transparent for you. I'n fact I tried to create an application using the latest nx-spring-boot plugin and it worked fine...

  • can you try reinstalling dependencies, after having removed the node_modules folder ?
$ npx nx reset ( to kill Nx daemon)
$ rm -rf node_modules
$ npm install
  • Can you share the output of the npx nx report command please?

@batnyu
Copy link
Author

batnyu commented Feb 19, 2024

Hi @tinesoft, thanks for your quick answer and your work on this project!

I tried resetting Nx, node-modules but I get the same error.

Here is the result of "npx nx report"

Node : 20.10.0
OS : win32-x64
npm : 10.2.3

nx : 18.0.4
@nx/js : 18.0.4
@nx/jest : 18.0.4
@nx/linter : 18.0.4
@nx/eslint : 18.0.4
@nx/workspace : 18.0.4
@nx/angular : 18.0.4
@nx/cypress : 18.0.4
@nx/devkit : 18.0.4
@nx/esbuild : 18.0.4
@nx/eslint-plugin : 18.0.4
@nx/plugin : 18.0.4
@nx/storybook : 18.0.4
@nrwl/tao : 18.0.4
@nx/web : 18.0.4
@nx/webpack : 18.0.4
typescript : 5.3.3

Community plugins:
@ngneat/transloco : 5.0.7
@nxrocks/nx-spring-boot : 9.2.2
@storybook/angular : 7.5.1
ng2-charts : 4.1.1

I downgraded to @nxrocks/nx-spring-boot@9.2.2 to display the report.
Maybe the error is caused by nx 18

@tinesoft
Copy link
Owner

tinesoft commented Feb 19, 2024

Can you get me through the actions you took step by step, to have the issue?
Because I cannot reproduce it...

What I did:

$ npx --yes create-nx-workspace@latest nx18
$ cd nx18
$ npm install --save-dev @nxrocks/nx-spring-boot@latest

$ npx nx report  (worked fined)
$ npx nx g @nxrocks/nx-spring-boot:project  (to generate a project, worked fine)

My Nx Report

$ npx nx report

 >  NX   Report complete - copy this into the issue template

   Node   : 18.16.0
   OS     : win32-x64
   npm    : 9.5.1

   nx             : 18.0.4
   @nx/js         : 18.0.4
   @nx/workspace  : 18.0.4
   @nx/devkit     : 18.0.4
   @nrwl/tao      : 18.0.4
   ---------------------------------------
   Community plugins:
   @nxrocks/nx-spring-boot : 9.3.0

@vixncu
Copy link

vixncu commented Feb 24, 2024

I confirm this happens to me too after upgrading to 9.3.0.

For me it was like this:

  1. Migrated to nx18 (from 17)
  2. Upgraded @nxrocks/nx-spring-boot to 9.3.0 (using yarn add @nxrocks/nx-spring-boot)

And that's it. After these 2 steps, whenever I run an nx command I get the following error:
(0 , common_jvm_1.createNodesFor) is not a function

Verbose dump of the command I ran:

yarn run build:ui-apps --verbose

 NX   (0 , common_jvm_1.createNodesFor) is not a function


Because of the error the Nx daemon process has exited. The next Nx command is going to restart the daemon process.
If the error persists, please run "nx reset".

{
  stack: 'TypeError: (0 , common_jvm_1.createNodesFor) is not a function\n' +
    '    at createNodesFn (/Users/vixncu/IdeaProjects/virtualconfig/node_modules/@nxrocks/nx-spring-boot/src/graph/create-nodes.js:8:61)\n' +
    '    at Object.<anonymous> (/Users/vixncu/IdeaProjects/virtualconfig/node_modules/@nxrocks/nx-spring-boot/src/index.js:12:56)\n' +
    '    at Module._compile (node:internal/modules/cjs/loader:1376:14)\n' +
    '    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)\n' +
    '    at Module.load (node:internal/modules/cjs/loader:1207:32)\n' +
    '    at Module._load (node:internal/modules/cjs/loader:1023:12)\n' +
    '    at Module.require (node:internal/modules/cjs/loader:1235:19)\n' +
    '    at require (node:internal/modules/helpers:176:18)\n' +
    '    at /Users/vixncu/IdeaProjects/virtualconfig/node_modules/nx/src/utils/nx-plugin.js:79:87\n' +
    '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
    '    at async loadNxPluginAsync (/Users/vixncu/IdeaProjects/virtualconfig/node_modules/nx/src/utils/nx-plugin.js:79:38)\n' +
    '    at async loadNxPlugins (/Users/vixncu/IdeaProjects/virtualconfig/node_modules/nx/src/utils/nx-plugin.js:105:21)\n' +
    '    at async retrieveProjectConfigurations (/Users/vixncu/IdeaProjects/virtualconfig/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:45:21)\n' +
    '    at async processFilesAndCreateAndSerializeProjectGraph (/Users/vixncu/IdeaProjects/virtualconfig/node_modules/nx/src/daemon/server/project-graph-incremental-recomputation.js:140:28)\n' +
    '    at async getCachedSerializedProjectGraphPromise (/Users/vixncu/IdeaProjects/virtualconfig/node_modules/nx/src/daemon/server/project-graph-incremental-recomputation.js:43:16)\n' +
    '    at async handleRequestProjectGraph (/Users/vixncu/IdeaProjects/virtualconfig/node_modules/nx/src/daemon/server/handle-request-project-graph.js:12:24)',
  message: '(0 , common_jvm_1.createNodesFor) is not a function\n' +
    '\n' +
    'Because of the error the Nx daemon process has exited. The next Nx command is going to restart the daemon process.\n' +
    'If the error persists, please run "nx reset".'
}

@dagassmann
Copy link

I use the @nxrocks/nx-quarkus library and ran into the same problem after upgrading from 7.2.2 to 7.3.0.
It seems the issue is that dependencies between @nxrocks libraries are managed using "*".
After I ran the following commands which updated the libraries to the latest version it worked again:

npm i @nxrocks/common-jvm@1.2.0
npm i @nxrocks/common@3.2.0

Hence it works when a new workspace is created but it breaks during updates. Maybe a good approach would be to specify versions more explicitly in the respective package.json instead of "*".

@tinesoft
Copy link
Owner

tinesoft commented Feb 29, 2024

Hi @vixncu , @dagassmann

Thanks for using the libraries and for the provided debug information (don't forget to ⭐ the project on Github, it helps ^^)

@dagassmann You might be on something indeed...

The "*" for the internal dependencies is required, because when publishing (which is done at once for all packages) , I don't know the exact version ahead of time. The "*" is to instruct NPM to use the latest version on NPM... This has always worked so far, as the @nxrocks/common-* are published first....

Something must be broken somewhere in that process.

I will have a closer look and let you know.

Stay tuned

@blackholegalaxy
Copy link

I also encounter the problem. Nx at 18.0.6. Angular and flutter project. We use @nxrocks/nx-flutter and bumping from 8.1.0 to 8.2.0 immediately created the error.

It impacts every NX command.

(0 , common_1.createNodesFor) is not a function


Because of the error the Nx daemon process has exited. The next Nx command is going to restart the daemon process.
If the error persists, please run "nx reset".

Downgrading to 8.1.0 fixes the issue.

Please note we use yarn 4.1.0

@tinesoft
Copy link
Owner

Closing, as it should be fixed in latest version of the plugin

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

5 participants