loopbackio / loopbackio/loopback-next

In an extension, Loopback CLI depends on @loopback/core in list of dependencies

Open
#9,476 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

### Describe the bug

Running CLI commands such as `lb4 model` in a loopback extension cause the commands to be aborted.

```No change to package.json was detected. No package manager install will be executed.
Generation is aborted: Error: No `@loopback/core` package found in the "dependencies" section of C:\Users\Ben\Documents\dev\customer-service\extensions\intercom\package.json. The command must be run in a LoopBack project.
```

This is because `@loopback/core` is not listed in dependencies. Yes it is both a `devDependency` and a `peerDependency` in a loopback extension. This was last discussed in #2163 and implemented in #2166.

Wouldn't it be a better developer experience if the command accepted `@loopback/core` as a `peerDependency`?

### Logs

```shell
$ lb4 model

No change to package.json was detected. No package manager install will be executed.
Generation is aborted: Error: No `@loopback/core` package found in the "dependencies" section of C:\Users\Ben\Documents\dev\customer-service\extensions\intercom\package.json. The command must be run in a LoopBack project.
```

### Additional information

_No response_

### Reproduction

n/a

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the `lb4 model` CLI entry point and trace the dependency check that reports the missing `@loopback/core` package. Reproduce the command in a LoopBack extension where `@loopback/core` is a peerDependency; done means the command is accepted without requiring it in `dependencies`.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.