loopbackio / loopback-next

LoopBack makes it easy to build modern API applications that require complex integrations.
https://loopback.io
Other
4.91k stars 1.06k forks source link

Cannot load db.datasource.config.json: ENOENT: no such file or directory #8465

Open andrei0807 opened 2 years ago

andrei0807 commented 2 years ago

Describe the bug

I got this error after upgrade cli version to 3.2.0 There is db.datasource.ts file in /src/datasources folder. but cli require db.datasource.config.json file. image

so to fix remove error I create empty db.datasource.config.json file in datasources folder but I got other error when I create repository by cli command. image I think it's bug. Please fix asap.

Logs

No response

Additional information

lb4 --version

@loopback/cli version: 3.2.0

@loopback/* dependencies:

Reproduction

cli version is 3.2.0 and I write loopback version list.

achrinza commented 2 years ago

As per-Documentation, please ensure that when using lb4 repository, either:

  1. A DataSource class with static defaultConfig containing the connector's configuration is present
  2. Legacy *.datasource.config.json (where * is the shared name of equivalent the TypeScript file without .datasource.ts) with the connector's configuration is present.

The error is a bit misleading: If the former condition is not satisfied, the CLI will attempt to load the legacy JSON file.

andrei0807 commented 2 years ago

image There was db.datasources.ts file. but I got error. so I created empty db.datasource.config.json file in order to remove error.

RokeyJoe commented 11 months ago

I fix it by changing the value of datasource.config.name to DB's name. image