Upgrade To 5.0.0 Breaks Server Bootup - Nest can't resolve dependencies
See original GitHub issueThis potential bug crashes the Nestjs server on bootup and stops all development work on the front and back ends.
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
Booting Nestjs with npm run start gives this message and the server won’t boot:
[Nest] 24918 - 2018-5-22 18:44:51 [NestFactory] Starting Nest application...
[Nest] 24918 - 2018-5-22 18:44:52 [InstanceLoader] TypeOrmModule dependencies initialized +277ms
[Nest] 24918 - 2018-5-22 18:44:52 [ExceptionHandler] Nest can't resolve dependencies of the MembersService (?). Please verify whether [0] argument is available in the current context.
Error: Nest can't resolve dependencies of the MembersService (?). Please verify whether [0] argument is available in the current context.
at Injector.lookupComponentInExports (/home/vagrant/nestjs/node_modules/@nestjs/core/injector/injector.js:129:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
1: node::Abort() [node]
2: 0x8c2459 [node]
3: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [node]
4: 0xad6f2c [node]
5: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node]
6: 0x25713df842fd
Aborted (core dumped)
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! Project_Fuser_Nestjs@1.0.0 start: `node index.js`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the Project_Fuser_Nestjs@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Expected behavior
After the minor modification to a service of replacing @Component with @Injectable the server should just boot up. The code worked with full CRUD before the upgrade to v5.
Minimal reproduction of the problem with instructions
The error message seems to relate to the following code.
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Members } from './members.entity';
@Injectable()
export class MembersService {
constructor(
@InjectRepository(Members)
private readonly membersRepository: Repository<Members>,
) {}
async findAll(): Promise<Members[]> {
return await this.membersRepository.find();
}
...
}
What is the motivation / use case for changing the behavior?
Nestjs server boots and full CRUD returns.
Environment
Nest version: 5.0.0 / @nestjs/typeorm 3.0.0 / TypeORM 0.2.6
/ Express 4.16.3 / RxJS 6.1.0 / @nestjs/cli 5.1.2
For Tooling issues:
- Node version: 8.11.2
- Platform: Ubuntu server 16.04.4
Others:
IDE Webstorm 2018.1.3 (the latest).
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (3 by maintainers)
Top Results From Across the Web
Fix for "Nest can't resolve dependencies of the MovieService."
I solved my problem. I messed up my imports/exports in some of the files of the project and after double-checking them it worked....
Read more >nest can't resolve dependencies of the cache_manager
I want to import CACHE_MANAGER from CacheModule to use in a userland cache in addition to the built-in controller cache. I'm using a...
Read more >Fixes integrated in HCL Digital Experience 8.5.0.0, 9.0 and 9.5 ...
This page lists the individual problems fixed and delivered in the combined cumulative fixes ("CFs") for HCL Portal Server and HCL Web Content...
Read more >Releases - styled-components
Releases. Updating styled components is usually as simple as npm install . Only major versions have the potential to introduce breaking changes (noted...
Read more >Solr News - Apache Solr
Updates bundled log4j2 dependencies to address CVE-2021-44228 (SOLR-15843) ... Fix for a SolrJ backwards compatibility issue when upgrading the server to ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve solved the problem! It didn’t work because I tried to import a service from another module instead of this module… 😃
Thanks @ThomRick but TypeORM is in my package.json and installed “├── typeorm@0.2.6”