loopback-next icon indicating copy to clipboard operation
loopback-next copied to clipboard

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

Open andrei0807 opened this issue 2 years ago • 3 comments

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:

  • @loopback/authentication: ^8.1.2
  • @loopback/boot: ^4.1.2
  • @loopback/build: ^8.1.2
  • @loopback/context: ^4.1.2
  • @loopback/core: ^3.1.2
  • @loopback/metadata: ^4.1.2
  • @loopback/openapi-spec-builder: ^4.1.2
  • @loopback/openapi-v3: ^7.1.2
  • @loopback/repository-json-schema: ^5.1.2
  • @loopback/repository: ^4.1.2
  • @loopback/rest: ^11.1.2
  • @loopback/testlab: ^4.1.2
  • @loopback/docs: ^4.0.4
  • @loopback/example-hello-world: ^4.1.2
  • @loopback/example-log-extension: ^4.1.2
  • @loopback/example-rpc-server: ^4.1.2
  • @loopback/example-todo: ^5.1.2
  • @loopback/example-soap-calculator: ^4.1.2
  • @loopback/service-proxy: ^4.1.2
  • @loopback/http-caching-proxy: ^3.1.2
  • @loopback/http-server: ^3.1.2
  • @loopback/example-todo-list: ^5.1.2
  • @loopback/dist-util: ^0.4.0
  • @loopback/rest-explorer: ^4.1.2
  • @loopback/eslint-config: ^12.0.4
  • @loopback/example-express-composition: ^4.1.2
  • @loopback/example-greeter-extension: ^4.1.2
  • @loopback/booter-lb3app: ^3.1.2
  • @loopback/example-lb3-application: ^4.1.2
  • @loopback/example-greeting-app: ^4.1.2
  • @loopback/example-context: ^4.1.2
  • @loopback/repository-tests: ^0.20.2
  • @loopback/health: ^0.10.2
  • @loopback/authorization: ^0.11.2
  • @loopback/rest-crud: ^0.13.2
  • @loopback/security: ^0.7.2
  • @loopback/authentication-passport: ^4.1.2
  • @loopback/example-metrics-prometheus: ^0.9.2
  • @loopback/metrics: ^0.10.2
  • @loopback/model-api-builder: ^3.1.2
  • @loopback/logging: ^0.8.2
  • @loopback/example-access-control-migration: ^4.1.2
  • @loopback/example-file-transfer: ^3.1.2
  • @loopback/example-rest-crud: ^3.1.2
  • @loopback/apiconnect: ^0.9.2
  • @loopback/example-validation-app: ^3.1.2
  • @loopback/cron: ^0.8.2
  • @loopback/example-multi-tenancy: ^0.12.2
  • @loopback/example-passport-login: ^3.1.2
  • @loopback/authentication-jwt: ^0.11.2
  • @loopback/context-explorer: ^0.7.2
  • @loopback/express: ^4.1.2
  • @loopback/example-todo-jwt: ^3.1.2
  • @loopback/mock-oauth2-provider: ^0.5.2
  • @loopback/pooling: ^0.7.2
  • @loopback/typeorm: ^0.6.2
  • @loopback/example-graphql: ^0.6.2
  • @loopback/graphql: ^0.7.2
  • @loopback/filter: ^2.1.2
  • @loopback/rest-msgpack: ^0.7.2
  • @loopback/example-binding-resolution: ^0.6.2
  • @loopback/example-webpack: ^0.7.2
  • @loopback/example-socketio: ^0.5.2
  • @loopback/socketio: ^0.5.2
  • @loopback/monorepo: ^0.4.4
  • @loopback/tsdocs: ^3.1.2

Reproduction

cli version is 3.2.0 and I write loopback version list.

andrei0807 avatar Apr 04 '22 02:04 andrei0807

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.

achrinza avatar Apr 04 '22 17:04 achrinza

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.

andrei0807 avatar Apr 04 '22 17:04 andrei0807

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

RokeyJoe avatar Sep 18 '23 02:09 RokeyJoe