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

Cannot destructure property metatype of 'undefined' or 'null' on related modules #493

Closed
twilroad opened this issue Mar 9, 2018 · 14 comments

Comments

@twilroad
Copy link

twilroad commented Mar 9, 2018

I'm submitting a...


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

Current behavior

in my project https://github.com/notadd/next, i define a test module like:

import { Module } from "@nestjs/common";

@Module({
})
export class TestModule {

}

thrown a exception:

TypeError: Cannot destructure property `metatype` of 'undefined' or 'null'.
    at flatMap.filter.related (/home/code/next/node_modules/@nestjs/core/injector/injector.js:226:38)
    at Array.filter (<anonymous>)
    at modules.concat.apply.modules.map (/home/code/next/node_modules/@nestjs/core/injector/injector.js:225:62)
    at Array.map (<anonymous>)
    at Injector.flatMap (/home/code/next/node_modules/@nestjs/core/injector/injector.js:223:54)
    at Injector.<anonymous> (/home/code/next/node_modules/@nestjs/core/injector/injector.js:197:46)
    at Generator.next (<anonymous>)
    at /home/code/next/node_modules/@nestjs/core/injector/injector.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/home/code/next/node_modules/@nestjs/core/injector/injector.js:3:12)
 1: node::Abort() [/usr/bin/node]
 2: 0x11ef459 [/usr/bin/node]
 3: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/bin/node]
 4: 0xb7c08c [/usr/bin/node]
 5: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/bin/node]
 6: 0x3e8d43f042fd

Expected behavior

Minimal reproduction of the problem with instructions

https://github.com/notadd/next

What is the motivation / use case for changing the behavior?

Environment


Nest version: 4.6.5
 
For Tooling issues:
- Node version: 9.3
- Platform:  Linux
@kamilmysliwiec
Copy link
Member

Please, could you point me to the particular file that throws an exception? It's a little bit difficult to go through the whole codebase. 🙂

@kamilmysliwiec
Copy link
Member

Could you let me know whether this bug still appears in the latest version v4.6.6?

@twilroad
Copy link
Author

@kamilmysliwiec yes, it still appears in v4.6.6

@kamilmysliwiec
Copy link
Member

I did a small investigation and the reason is a circular dependency that exists somewhere (for example, between components). I'd provide more descriptive error messages here. Hence, debugging should be much easier.

@kamilmysliwiec kamilmysliwiec added this to the 5.0.0 milestone Apr 20, 2018
@yogendradixit-ultra
Copy link

I am getting TypeError: metatype is not a constructor. Please find below error.

Debugger listening on ws://127.0.0.1:9229/7cbd1c87-eb9e-4a22-bd94-b01d7e7a2399
For help see https://nodejs.org/en/docs/inspector
[Nest] 30828 - 2018-7-18 14:33:25 [NestFactory] Starting Nest application...
[Nest] 30828 - 2018-7-18 14:33:25 [ExceptionHandler] metatype is not a constructor
TypeError: metatype is not a constructor
at resolveConstructorParams (D:\kltra-test\game-service\node_modules@nestjs\core\injector\injector.js:64:84)
at Injector.resolveConstructorParams (D:\kltra-test\game-service\node_modules@nestjs\core\injector\injector.js:86:30)
at
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
at Function.Module.runMain (module.js:695:11)
at Object. (D:\kltra-test\game-service\node_modules\ts-node\src_bin.ts:177:12)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
1: node::DecodeWrite
2: v8::internal::wasm::SignatureMap::Find
3: v8::internal::Builtins::CallableFor
4: v8::internal::Builtins::CallableFor
5: v8::internal::Builtins::CallableFor
6: 0000025CCEE843C1
npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! game-service start: ts-node --inspect -r tsconfig-paths/register src/main.ts
npm ERR! Exit status 3

@weq95
Copy link

weq95 commented Nov 11, 2018

webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

TypeError: Cannot destructure property compile of 'undefined' or 'null'.
at addHooks (C:\wamp64\www\vuenews\node_modules\webpack-dev-server\lib\Server.js:114:49)
at new Server (C:\wamp64\www\vuenews\node_modules\webpack-dev-server\lib\Server.js:127:5)
at startDevServer (C:\wamp64\www\vuenews\node_modules\webpack-dev-server\bin\webpack-dev-server.js:355:14)
at processOptions (C:\wamp64\www\vuenews\node_modules\webpack-dev-server\bin\webpack-dev-server.js:309:5)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)

    1. How can I solve this problem?

@zpcjingyu
Copy link

@11084956 我也遇到这个问题了,你解决了吗?

@weq95
Copy link

weq95 commented Nov 14, 2018

@zpcjingyu 没有啊

@happyring
Copy link

webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

TypeError: Cannot destructure property compile of 'undefined' or 'null'.
at addHooks (C:\wamp64\www\vuenews\node_modules\webpack-dev-server\lib\Server.js:114:49)
at new Server (C:\wamp64\www\vuenews\node_modules\webpack-dev-server\lib\Server.js:127:5)
at startDevServer (C:\wamp64\www\vuenews\node_modules\webpack-dev-server\bin\webpack-dev-server.js:355:14)
at processOptions (C:\wamp64\www\vuenews\node_modules\webpack-dev-server\bin\webpack-dev-server.js:309:5)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)

    1. How can I solve this problem?

同样的问题,是否解决了?

@BobYoung2014
Copy link

@11084956 我也遇到这个问题了,你解决了吗?

我刚刚也遇到这个问题,执行以下语句解决了:
npm install -D webpack-dev-server@3.0.0

希望对你有帮助

@BobYoung2014
Copy link

@zpcjingyu 没有啊

我刚刚也遇到这个问题,执行以下语句解决了:
npm install -D webpack-dev-server@3.0.0

希望对你有帮助

@weq95
Copy link

weq95 commented Nov 25, 2018 via email

@lock
Copy link

lock bot commented Sep 24, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants