Nest: Cannot read property 'name' of undefined

Created on 5 Jul 2018  路  5Comments  路  Source: nestjs/nest

I'm submitting a...



[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

After upgrading to 5.1.0 from 5.0.1 and run yarn start the following error appears:

[nodemon] 1.17.5
[nodemon] to restart at any time, enter rs
[nodemon] watching: d:\Desa\TS\authservice\server\src/*/
[nodemon] starting ts-node -r tsconfig-paths/register src/main.ts
[Nest] 1764 - 2018-7-5 10:24:07 [NestFactory] Starting Nest application...
[Nest] 1764 - 2018-7-5 10:24:07 [ExceptionHandler] Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
at Module.addModuleAsComponent (d:\Desa\TS\authservice\servernode_modules\@nestjs\core\injector\module.js:72:45)
at Module.addCoreInjectables (d:\Desa\TS\authservice\servernode_modules\@nestjs\core\injector\module.js:56:14)
at new Module (d:\Desa\TS\authservice\servernode_modules\@nestjs\core\injector\module.js:24:14)
at NestContainer.addModule (d:\Desa\TS\authservice\servernode_modules\@nestjs\core\injector\container.js:35:24)
at DependenciesScanner.storeModule (d:\Desa\TS\authservice\servernode_modules\@nestjs\core\scanner.js:32:30)
at DependenciesScanner.scanForModules (d:\Desa\TS\authservice\servernode_modules\@nestjs\core\scanner.js:22:20)
at DependenciesScanner.scan (d:\Desa\TS\authservice\servernode_modules\@nestjs\core\scanner.js:17:20)
at exceptions_zone_1.ExceptionsZone.asyncRun (d:\Desa\TS\authservice\servernode_modules\@nestjs\core\nest-factory.js:75:43)
at Function.asyncRun (d:\Desa\TS\authservice\servernode_modules\@nestjs\core\errors\exceptions-zone.js:17:19)
at NestFactoryStatic.initialize (d:\Desa\TS\authservice\servernode_modules\@nestjs\core\nest-factory.js:74:52)
[nodemon] app crashed - waiting for file changes before starting...

Environment

Nest version: 5.1.0

For Tooling issues:

  • Node version: 8.11.3
  • Platform: Windows

Others:
Anything else relevant? Windows 7, VSCode, yarn

Most helpful comment

Sorry
I deleted the node_modules folder and reinstalled the packages and the error disappeared. Previously run yarn upgrade that apparently does not always work.

All 5 comments

You are running the develop script directly with nodemon, if you do it with the npm/yarn command wich call nodemon, the error is resolved.

$ yarn start
yarn run v1.7.0
$ ts-node -r tsconfig-paths/register src/main.ts
[Nest] 6160 - 2018-7-5 10:59:29 [NestFactory] Starting Nest application...
[Nest] 6160 - 2018-7-5 10:59:29 [ExceptionHandler] Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
at Module.addModuleAsComponent (D:\Desa\TS\authservice\servernode_modules\@nestjs\core\injector\module.js:72:45)
at Module.addCoreInjectables (D:\Desa\TS\authservice\servernode_modules\@nestjs\core\injector\module.js:56:14)
at new Module (D:\Desa\TS\authservice\servernode_modules\@nestjs\core\injector\module.js:24:14)
at NestContainer.addModule (D:\Desa\TS\authservice\servernode_modules\@nestjs\core\injector\container.js:35:24)
at DependenciesScanner.storeModule (D:\Desa\TS\authservice\servernode_modules\@nestjs\core\scanner.js:32:30)
at DependenciesScanner.scanForModules (D:\Desa\TS\authservice\servernode_modules\@nestjs\core\scanner.js:22:20)
at DependenciesScanner.scan (D:\Desa\TS\authservice\servernode_modules\@nestjs\core\scanner.js:17:20)
at exceptions_zone_1.ExceptionsZone.asyncRun (D:\Desa\TS\authservice\servernode_modules\@nestjs\core\nest-factory.js:75:43)
at Function.asyncRun (D:\Desa\TS\authservice\servernode_modules\@nestjs\core\errors\exceptions-zone.js:17:19)
at NestFactoryStatic.initialize (D:\Desa\TS\authservice\servernode_modules\@nestjs\core\nest-factory.js:74:52)
error Command failed with exit code 3.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Sorry
I deleted the node_modules folder and reinstalled the packages and the error disappeared. Previously run yarn upgrade that apparently does not always work.

Same here. with nodemon and yarn.
I had to delete the node_modules/ maually and reinstall.
Thank you @sgomanf

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KamGor picture KamGor  路  3Comments

VRspace4 picture VRspace4  路  3Comments

breitsmiley picture breitsmiley  路  3Comments

marshall007 picture marshall007  路  3Comments

menme95 picture menme95  路  3Comments