2

I am using Loopback 4 to create a REST-ful API. I'm a mobile developer by trade so typescript et al is all pretty new to me, so please be kind ;)

I created the app using CLI v1.21.4, and saw a message to say that an update is available. I therefore updated my global installation of the CLI. But then when I try and run one of the commands such as lb4 model I see the message:

The project was originally generated by @loopback/cli@1.21.4.

The following dependencies are incompatible with @loopback/cli@1.23.1:

  • typescript: ~3.5.3 (cli ~3.6.3)
  • @loopback/authentication: ^2.2.2 (cli ^3.1.1)

I would of course like to take advantage of these newer modules, but I am unsure how to update my app scaffolding and dependencies. Could anyone offer some advice please?

Community
  • 1
  • 1
Ian L
  • 5,553
  • 1
  • 22
  • 37

3 Answers3

1

Please check out https://github.com/strongloop/loopback-next/issues/3608:

  1. During lb4 app, we add the cli version to .yo.rc.json, such as:

    { "@loopback/cli": { "version": "1.21.4" } }

  2. lb4 -v lists compatible modules that are released with the cli.

  3. lb4 commands check if the project has incompatible versions with the current cli and prompts users to force or exit.

Raymond Feng
  • 1,516
  • 9
  • 5
0

I would of course like to take advantage of these newer modules, but I am unsure how to update my app scaffolding and dependencies.

The process for updating dependencies is not specific to LoopBack. If you are using npm, then simply run npm update.

Please note that TypeScript often introduces backwards-incompatible changes in semver-minor releases, 3.6 brought few of them. Be prepared to manually fix few compilation errors after the upgrade.

I think that npm update is not going to jump from v2 to v3 for @loopback/authentication, you have to request that upgrade explicitly:

$ npm install @loopback/authentication@latest
Miroslav Bajtoš
  • 10,667
  • 1
  • 41
  • 99
0

There is now a supported update procedure, which is documented here:

https://loopback.io/doc/en/lb4/Update-generator.html

It seems to be simply:

# Ensure you have the latest version of the CLI tool
npm install -g @loopback/cli

# Then ask the tool to check which packages should be upgraded
lb4 update
joeytwiddle
  • 29,306
  • 13
  • 121
  • 110