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

Unable to serve NestJS app in 15.9.2 #16489

Closed
kdawgwilk opened this issue Apr 23, 2023 · 3 comments · Fixed by #16510
Closed

Unable to serve NestJS app in 15.9.2 #16489

kdawgwilk opened this issue Apr 23, 2023 · 3 comments · Fixed by #16510

Comments

@kdawgwilk
Copy link
Contributor

Current Behavior

> nx run api:serve

 >  NX   Cannot read properties of undefined (reading 'name')
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Running target serve for project api failed

   Failed tasks:
   
   - api:serve
   
   Hint: run the command with --verbose for more details.

Expected Behavior

serve runs normally

GitHub Repo

No response

Steps to Reproduce

  1. Upgrade workspace to 15.9.2

Nx Report

>  NX   Report complete - copy this into the issue template

   Node : 16.14.0
   OS   : darwin arm64
   npm  : 8.3.1
   
   nx                      : 15.9.2
   @nrwl/js                : 15.9.2
   @nrwl/jest              : 15.9.2
   @nrwl/linter            : 15.9.2
   @nrwl/workspace         : 15.9.2
   @nrwl/cli               : 15.9.2
   @nrwl/cypress           : 15.9.2
   @nrwl/devkit            : 15.9.2
   @nrwl/eslint-plugin-nx  : 15.9.2
   @nrwl/nest              : 15.9.2
   @nrwl/node              : 15.9.2
   @nrwl/react             : 15.9.2
   @nrwl/storybook         : 15.9.2
   @nrwl/tao               : 15.9.2
   @nrwl/vite              : 15.9.2
   @nrwl/webpack           : 15.9.2
   typescript              : 4.9.5

Failure Logs

> nx run api:serve

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


HookWebpackError: Cannot read properties of undefined (reading 'name')
    at makeWebpackError (/Users/kwilk/Sources/my-project/node_modules/webpack/lib/HookWebpackError.js:48:9)
    at /Users/kwilk/Sources/my-project/node_modules/webpack/lib/Compilation.js:3061:12
    at eval (eval at create (/Users/kwilk/Sources/my-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:33:1)
    at fn (/Users/kwilk/Sources/my-project/node_modules/webpack/lib/Compilation.js:480:17)
    at _next0 (eval at create (/Users/kwilk/Sources/my-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:31:1)
    at eval (eval at create (/Users/kwilk/Sources/my-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:44:1)
    at eval (eval at create (/Users/kwilk/Sources/my-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at /Users/kwilk/Sources/my-project/node_modules/webpack/lib/Compilation.js:502:10
    at Hook.eval [as callAsync] (eval at create (/Users/kwilk/Sources/my-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/kwilk/Sources/my-project/node_modules/tapable/lib/Hook.js:18:14)
-- inner error --
TypeError: Cannot read properties of undefined (reading 'name')
    at findAllNpmDeps (/Users/kwilk/Sources/my-project/node_modules/nx/src/plugins/js/package-json/create-package-json.js:107:30)
    at findAllNpmDeps (/Users/kwilk/Sources/my-project/node_modules/nx/src/plugins/js/package-json/create-package-json.js:130:17)
    at createPackageJson (/Users/kwilk/Sources/my-project/node_modules/nx/src/plugins/js/package-json/create-package-json.js:34:5)
    at /Users/kwilk/Sources/my-project/node_modules/@nrwl/webpack/src/plugins/generate-package-json-plugin.js:35:64
    at fn (/Users/kwilk/Sources/my-project/node_modules/webpack/lib/Compilation.js:478:10)
    at _next0 (eval at create (/Users/kwilk/Sources/my-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:31:1)
    at eval (eval at create (/Users/kwilk/Sources/my-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:44:1)
    at eval (eval at create (/Users/kwilk/Sources/my-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at /Users/kwilk/Sources/my-project/node_modules/webpack/lib/Compilation.js:502:10
    at Hook.eval [as callAsync] (eval at create (/Users/kwilk/Sources/my-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)

 ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Running target serve for project api failed

   Failed tasks:
   
   - api:serve
   
   Hint: run the command with --verbose for more details.

Additional Information

Upgraded from Nx 15.6.3 -> 15.9.2 when the issue happened

@kdawgwilk
Copy link
Contributor Author

Figure this out after some more debugging, it was because I had a import for a package that I had uninstalled in my code. Pretty obscure error that was tricky to track down. A better error message for this would be very helpful

@omniviewsports
Copy link

@kdawgwilk I fixed this by updating typescript to the newest 5.X.X version.

@github-actions
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 May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants