【问题标题】:NPM install from inside gitlab project从 gitlab 项目内部安装 NPM
【发布时间】:2020-03-06 10:07:03
【问题描述】:

我有 2 个存储库。一是main,二是依赖包。

在 .gitlab-ci.yml 的主项目中,我有:

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 有 package.json 应该使用 `npm -i" 作为依赖安装:

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

一个问题是CI没有识别路径:

$ 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'

【问题讨论】:

  • 这个命令对你本地有用吗?
  • 不,SSH 和 22 端口已关闭。

标签: npm continuous-integration gitlab


【解决方案1】:

使用自托管https://verdaccio.org/ 发布 NPM 包解决了这个问题。

为了发布到 Gitlab,它应该升级 Gitlab 包(银版)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-15
    • 2021-11-04
    • 2019-06-21
    • 2012-09-14
    • 2011-04-21
    • 2023-03-11
    • 2016-11-01
    相关资源
    最近更新 更多