Marin Sagovac
Marin Sagovac

Reputation: 3972

NPM install from inside gitlab project

I have 2 repository. One is main, second is dependency package.

In main project in .gitlab-ci.yml I have:

install_dependency:
  stage: install-dep
  before_script:
    - npm config set strict-ssl false
    - ls -la
  script:
    - git config --global http.sslverify false
    - npm config set @my-package:registry https://${TOKEN_USERNAME}:${TOKEN_PASSWORD}@HOST/PACKAGE/PACKAGE.git
    - npm i git+https://${TOKEN_USERNAME}:${TOKEN_PASSWORD}@HOST/react.git#master

Dependecy have package.json that should install using `npm -i" as dependecy:

package/mypackage: git+https://${TOKEN_USERNAME}:${TOKEN_PASSWORD}@HOST/react.git#master

A problem is that CI did not recognize path:

$ npm i git+https://${TOKEN_USERNAME}:${TOKEN_PASSWORD}@HOST/react.git#master
npm ERR! prepareGitDep 2> npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead.
npm ERR! prepareGitDep npm WARN tar ENOENT: no such file or directory, open '/root/.npm/_cacache/tmp/git-clone-7b8b3c6a/node_modules/.staging/uglify-js-ce069d2e/lib/compress.js'

Upvotes: 1

Views: 534

Answers (1)

Marin Sagovac
Marin Sagovac

Reputation: 3972

Use self-hosted https://verdaccio.org/ to publish NPM package solves that issue.

For publishing into Gitlab it should upgrade Gitlab package (silver ediiton).

Upvotes: 1

Related Questions