Search code examples
loopbackjsloopback4

Updating Loopback 4


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/[email protected].

The following dependencies are incompatible with @loopback/[email protected]:

  • 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?


Solution

  • 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