question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MongooseCoreModule cannot be exported

See original GitHub issue

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.

Current behavior

When bootstrapping the Application and importing the Mongoose module, the application crashes with following message:

 Nest cannot export component / module that is not a part of the currently proccessed module (MongooseCoreModule). Please verify whether each exported unit is available in this particular context.

Expected behavior

Mongoose module should get imported without errors

Minimal reproduction of the problem with instructions


@Module({
    imports: [
        MongooseModule.forRoot(/* some connection url*/)
    ]
})
export class ApplicationModule {
}

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

We use NestJS on our production servers, so for obvious reasons.

Environment

{
    "@nestjs/core": "^4.5.10",
    "@nestjs/microservices": "^4.5.8",
    "@nestjs/mongoose": "^3.0.1",
    "@nestjs/testing": "^4.5.5",
    "@nestjs/typeorm": "^2.0.0",
    "@nestjs/websockets": "^4.5.8",
    "@types/mongoose": "^5.0.13",
    "mongoose": "^5.0.17"
}

Nest version: 4.5.x

 
For Tooling issues:
- Node version: 8
- Platform:  Docker running Linux (Ubuntu 16.04)

Others:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
cesarpcommented, May 22, 2018

This happened to me and I also noticed that the InjectModel signature had a breaking change between version 3.0.1 and 3.0.2 which should not be the case if this is following semver.

In version 3.0.1 you can pass a schema but in 3.0.2 you have to pass a string.

1reaction
kamilmysliwieccommented, May 28, 2018

For those who face this issue as well - please, lock your version with 3.0.1 if your app uses Nest@4. Now, all packages follow the same semantic versioning (@nestjs/mongoose@5.0.0 matches Nest@5)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nest can't resolve dependencies of the ... - Stack Overflow
Nest can't resolve dependencies of the MongooseCoreModule (MongooseConnectionName, ?). Please make sure that the argument ModuleRef at index ...
Read more >
Module reference | NestJS - A progressive Node.js framework
Hint The ModuleRef class is imported from the @nestjs/core package. Retrieving instances#. The ModuleRef instance (hereafter we'll refer to it ...
Read more >
NestJS: Resolving Dependency Injection - Tevpro
If dependency is exported from a separate @Module, is that module imported within AuthModule? @Module({ imports: [ /* the Module containing dependency */...
Read more >
NestJS + Typegoose | tnc - nartc.netlify.com
Create an abstract class so it cannot be initialized ( new() up ) ... shared/base.model'; export class Product extends BaseModel { @prop() ...
Read more >
Module '"mongoose"' has no exported member ... - YouTube
In this video, we fix an error related to DocumentDefinition and update service inputs so they do not need to omit values.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found