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

[@nx/express 18.0.4] nx g applications or libs throws error #21950

Closed
1 of 4 tasks
nawlbergs opened this issue Feb 22, 2024 · 2 comments · Fixed by #21952
Closed
1 of 4 tasks

[@nx/express 18.0.4] nx g applications or libs throws error #21950

nawlbergs opened this issue Feb 22, 2024 · 2 comments · Fixed by #21952
Assignees
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug

Comments

@nawlbergs
Copy link

nawlbergs commented Feb 22, 2024

Current Behavior

Both the Nx UI plugin and command line throw a Cannot read properties of undefined (reading 'test') error. No matter what options/flag are set.

This is in a brand-new nx repo... I added nx... then I added an @nx/angular app... the @nx/express app will not generate.

Expected Behavior

An express app to generate... or even a dry-run print out when using the UI.

GitHub Repo

https://github.com/nawlbergs/nx-express-issue

Steps to Reproduce

  1. Create a new app with nx init. Try to add an @nx/express application.

Nx Report

Node   : 20.9.0
   OS     : darwin-arm64
   npm    : 10.1.0
   
   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/eslint-plugin  : 18.0.4
   @nx/express        : 18.0.4
   @nx/node           : 18.0.4
   @nrwl/tao          : 18.0.4
   @nx/web            : 18.0.4
   @nx/webpack        : 18.0.4
   typescript         : 5.3.3

Failure Logs

$ nx g @nx/express:app my-express-api --directory=apps/my-express-api --verbose



>  NX  Generating @nx/express:application

✔ What should be the project name and where should it be generated? · my-express-api @ apps/my-express-api

 >  NX   Cannot read properties of undefined (reading 'test')


TypeError: Cannot read properties of undefined (reading 'test')
    at createJestConfig (/Users/nalberg/Sites/nx-test/node_modules/@nx/jest/src/generators/configuration/lib/create-jest-config.js:47:42)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async configurationGeneratorInternal (/Users/nalberg/Sites/nx-test/node_modules/@nx/jest/src/generators/configuration/configuration.js:60:5)
    at async applicationGeneratorInternal (/Users/nalberg/Sites/nx-test/node_modules/@nx/node/src/generators/application/application.js:325:26)
    at async applicationGenerator (/Users/nalberg/Sites/nx-test/node_modules/@nx/node/src/generators/application/application.js:265:12)
    at async applicationGeneratorInternal (/Users/nalberg/Sites/nx-test/node_modules/@nx/express/src/generators/application/application.js:57:29)
    at async /Users/nalberg/Sites/nx-test/node_modules/nx/src/command-line/generate/generate.js:241:26
    at async handleErrors (/Users/nalberg/Sites/nx-test/node_modules/nx/src/utils/params.js:9:16)
    at async Object.handler (/Users/nalberg/Sites/nx-test/node_modules/nx/src/command-line/generate/command-object.js:13:22)

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@nawlbergs nawlbergs changed the title [@nx/express 18.0.4] g @nx/express:app throws error [@nx/express 18.0.4] nx g @nx/express:app throws error Feb 22, 2024
@nawlbergs
Copy link
Author

After more farting around with this... it seems I cannot add a second library or application period!

If I:

  1. Revert back to my initial commit... (which is basically just an empty repo with an nx.json file)
  2. Added a js/lib using the NX UI.
  3. Try to do it again for a second library nx g @nx/js:library --name=lib2 --unitTestRunner=jest --projectNameAndRootFormat=as-provided --no-interactive --dry-run
  4. I get the same error:
nx g @nx/js:library --name=lib2 --unitTestRunner=jest --projectNameAndRootFormat=as-provided --no-interactive --dry-run

>  NX  Generating @nx/js:library


 >  NX   Cannot read properties of undefined (reading 'test')

   Pass --verbose to see the stacktrace.

@nawlbergs nawlbergs changed the title [@nx/express 18.0.4] nx g @nx/express:app throws error [@nx/express 18.0.4] nx g applications or libs throws error Feb 22, 2024
@AgentEnder AgentEnder added scope: node Issues related to Node, Express, NestJS support for Nx scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx labels Feb 22, 2024
@AgentEnder AgentEnder self-assigned this Feb 22, 2024
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants