'Can't deploy my Loopback package on private NPM repository (Unsupported engine)

I want to deploy a Loopback package to a private NPM repository on Gitlab, but I am getting an "Unsupported engine" error :

Running with gitlab-runner 14.7.0 (98daeee0)
  on PC
Preparing the "docker" executor 00:06
Using Docker executor with image node:latest ...
Pulling docker image node:latest ...
Using docker image sha256:imagenumber for node:latest with digest node@sha256:imagenumber  ...
Preparing environment 00:01
Running on runner via PC...
Getting source from Git repository 00:03
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /builds/cXXXX/loopback-lib/.git/
Checking out version as main...
Removing .npm/
Removing node_modules/
Skipping Git submodules setup
Restoring cache 00:01
Checking cache for cachenumber...
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted. 
Successfully extracted cache
Checking cache for main...
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted. 
Successfully extracted cache
Executing "step_script" stage of the job script 00:25
Using docker image sha256:f8c8d04432c3686347434420abcc20646237c5685b4b11a7db63df7acb866cd6 for node:latest with digest node@sha256:a0590a265b222387d756ba357c4a9875778f1a7638ac011f3fb4942d3b7ae5c0 ...
$ npm ci --cache .npm --prefer-offline
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@loopback/[email protected]',
npm WARN EBADENGINE   required: { node: '^10.16 || 12 || 14 || 16' },
npm WARN EBADENGINE   current: { node: 'v17.5.0', npm: '8.4.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@loopback/[email protected]',
npm WARN EBADENGINE   required: { node: '^10.16 || 12 || 14 || 16' },
npm WARN EBADENGINE   current: { node: 'v17.5.0', npm: '8.4.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@loopback/[email protected]',
npm WARN EBADENGINE   required: { node: '^10.16 || 12 || 14 || 16' },
npm WARN EBADENGINE   current: { node: 'v17.5.0', npm: '8.4.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@loopback/[email protected]',
npm WARN EBADENGINE   required: { node: '^10.16 || 12 || 14 || 16' },
npm WARN EBADENGINE   current: { node: 'v17.5.0', npm: '8.4.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@loopback/[email protected]',
npm WARN EBADENGINE   required: { node: '^10.16 || 12 || 14 || 16' },
npm WARN EBADENGINE   current: { node: 'v17.5.0', npm: '8.4.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@loopback/[email protected]',
npm WARN EBADENGINE   required: { node: '^10.16 || 12 || 14 || 16' },
npm WARN EBADENGINE   current: { node: 'v17.5.0', npm: '8.4.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@loopback/[email protected]',
npm WARN EBADENGINE   required: { node: '^10.16 || 12 || 14 || 16' },
npm WARN EBADENGINE   current: { node: 'v17.5.0', npm: '8.4.1' }
npm WARN EBADENGINE }
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR!     /builds/cXXXX/loopback-lib/.npm/_logs/2022-02-21T14_19_48_171Z-debug-0.log
Cleaning up project directory and file based variables 00:04
ERROR: Job failed: exit code 1

I may be doing something wrong with my package initially. I am not quite sure how one would create a Loopback package. Here is the package.json :

{
  "name": "@my-group/loopback-lib",
  "version": "1.0.2",
  "dependencies": {
    "tslib": "^2.0.0"
  },
  "publishConfig": {
    "@my-group:registry": "https://gitlab.com/api/v4/projects/XXXXXX/packages/npm/"
  },
  "peerDependencies": {
    "@loopback/core": "^2.9.1",
    "@loopback/rest": "^5.2.0"
  },
  "devDependencies": {
    "@loopback/build": "^6.1.0",
    "@loopback/core": "^2.9.1",
    "@loopback/eslint-config": "^8.0.3",
    "@loopback/rest": "^5.2.0",
    "@loopback/testlab": "^3.2.0",
    "semantic-release": "^19.0.2",
    "@semantic-release/git": "^10.0.1",
    "@semantic-release/gitlab": "^7.0.4",
    "@semantic-release/npm": "^9.0.0"
  }
}

I have tried fiddling with the dependencies, but to no avail.

Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source