使用私有GitLab与NPM的依赖关系

Axi*_*iol 7 node.js npm gitlab

我正在尝试从私有GitLab instence安装NPM依赖项.

所以,我有基本文件的repo

在此输入图像描述

package.json在我的项目中添加了这个依赖项

"node-demo-package": "https://oauth2:<ACCESS TOKEN>@gitlab.fullurl.git"
Run Code Online (Sandbox Code Playgroud)

但是,当我运行时npm install,我收到此错误消息:

npm ERR! code ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: node-demo-package@https://oauth2:<ACCESS TOKEN>@gitlab.fullurl.git.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/arnaud.delante/.npm/_logs/2018-01-24T15_05_49_456Z-debug.log
Run Code Online (Sandbox Code Playgroud)

我不明白,因为package.json屏幕截图中显示了一个.

这里是

{
  "name": "demo-package",
  "version": "1.0.0",
  "description": "Test pasckage",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git@gitlab.fullurl.git"
  },
  "author": "Arnaud Delante",
  "license": "MIT"
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试切换httpsgit+https,但我得到另一个错误

npm ERR! Error while executing:
npm ERR! /usr/local/bin/git ls-remote -h -t https://oauth2:<ACCES TOKEN>@gitlab.fullrul.git
npm ERR!
npm ERR! remote: You are not allowed to download code from this project.
npm ERR! fatal: unable to access 'https://oauth2:<ACCES TOKEN>@gitlab.fullrul.git': The requested URL returned error: 403
npm ERR!
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/arnaud.delante/.npm/_logs/2018-01-24T17_19_16_677Z-debug.log
Run Code Online (Sandbox Code Playgroud)

这很奇怪,因为令牌是正确的.

你有什么想法吗?

Gab*_*leu 6

在 package.json 中尝试替换https://git+https://

文档:https : //docs.npmjs.com/files/package.json#git-urls-as-dependencies