执行npm发布时github托管包失败

上周工作正常,因此不确定发生了什么。 (对于某些格式的道歉,因为记录了很多行)

节点版本:v10.15.3

npm版本:6.4.1

我在项目文件夹中进行了npm publish并收到以下错误:

npm ERR! code E400
npm ERR! failed to stream package from json: repo name with owner has wrong number of components: [github.com company dev-js] (wanted 2,got 3) : @company/dev-js

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/luke/.npm/_logs/2020-01-27T16_00_11_703Z-debug.log

调试日志如下:

18 verbose getPublishConfig { registry: 'https://npm.pkg.github.com/' }
19 silly mapToRegistry name @company/dev-js
20 silly mapToRegistry scope (from package name) @company
21 verbose mapToRegistry no registry URL found in name for scope @company
22 silly mapToRegistry using default registry
23 silly mapToRegistry registry https://npm.pkg.github.com/
24 silly mapToRegistry data { type: 'tag',24 silly mapToRegistry   registry: true,24 silly mapToRegistry   where: undefined,24 silly mapToRegistry   raw: '@company/dev-js',24 silly mapToRegistry   name: '@company/dev-js',24 silly mapToRegistry   escapedName: '@company%2fdev-js',24 silly mapToRegistry   scope: '@company',24 silly mapToRegistry   rawSpec: '',24 silly mapToRegistry   saveSpec: null,24 silly mapToRegistry   fetchSpec: 'latest',24 silly mapToRegistry   gitRange: undefined,24 silly mapToRegistry   gitCommittish: undefined,24 silly mapToRegistry   hosted: undefined }
25 silly mapToRegistry uri https://npm.pkg.github.com/@company%2fdev-js
26 verbose publish registryBase https://npm.pkg.github.com/
27 silly publish uploading /tmp/npm-14124-7d74fb5c/tmp/fromDir-c3e4ff77/package.tgz
28 verbose request uri https://npm.pkg.github.com/@company%2fdev-js
29 verbose request sending authorization for write operation
30 info attempt registry request try #1 at 4:03:50 PM
31 verbose request using bearer token for auth
32 verbose request id 43a1c9b1771b70fc
33 http request PUT https://npm.pkg.github.com/@company%2fdev-js
34 http 400 https://npm.pkg.github.com/@company%2fdev-js
35 verbose headers { 'content-security-policy': 'default-src \'none\';',35 verbose headers   'content-type': 'application/json; charset=utf-8',35 verbose headers   server: 'GitHub Registry',35 verbose headers   'strict-transport-security': 'max-age=31536000;',35 verbose headers   'x-content-type-options': 'nosniff',35 verbose headers   'x-frame-options': 'DENY',35 verbose headers   'x-xss-protection': '1; mode=block',35 verbose headers   date: 'Mon,27 Jan 2020 16:03:51 GMT',35 verbose headers   'content-length': '150',35 verbose headers   'x-github-request-id': 'BC70:4A22:14B33:AFF19:5E2F09E6' }
36 error publish Failed PUT 400
37 verbose stack Error: failed to stream package from json: repo name with owner has wrong number of components: [github.com company dev-js] (wanted 2,got 3) : @company/dev-js
37 verbose stack     at makeError (/home/luke/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:329:12)
37 verbose stack     at RegClient.<anonymous> (/home/luke/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:317:14)
37 verbose stack     at Request._callback (/home/luke/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:216:14)
37 verbose stack     at Request.self.callback (/home/luke/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/request/request.js:185:22)
37 verbose stack     at Request.emit (events.js:189:13)
37 verbose stack     at Request.<anonymous> (/home/luke/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/request/request.js:1161:10)
37 verbose stack     at Request.emit (events.js:189:13)
37 verbose stack     at IncomingMessage.<anonymous> (/home/luke/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/request/request.js:1083:12)
37 verbose stack     at Object.onceWrapper (events.js:277:13)
37 verbose stack     at IncomingMessage.emit (events.js:194:15)
37 verbose stack     at endReadableNT (_stream_readable.js:1125:12)
37 verbose stack     at process._tickCallback (internal/process/next_tick.js:63:19)
38 verbose statusCode 400
39 verbose pkgid @company/dev-js
40 verbose cwd /var/www/vhosts/test/httpdocs/dev-js
41 verbose Linux 2.6.32-754.22.1.el6.x86_64
42 verbose argv "/home/luke/.nvm/versions/node/v10.15.3/bin/node" "/home/luke/.nvm/versions/node/v10.15.3/bin/npm" "publish"
43 verbose node v10.15.3
44 verbose npm  v6.4.1
45 error code E400
46 error failed to stream package from json: repo name with owner has wrong number of components: [github.com company dev-js] (wanted 2,got 3) : @company/dev-js
47 verbose exit [ 1,true ]

其他注意事项:

npm config get registry返回:https://npm.pkg.github.com/company

npm logout也会出错:

npm ERR! Unexpected token p in JSON at position 4
npm ERR! 404 page not found
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/luke/.npm/_logs/2020-01-27T16_13_29_526Z-debug.log

任何帮助将不胜感激! 谢谢

aa4892278 回答:执行npm发布时github托管包失败

如果这对我的package.json文件具有以下内容的任何人都有用:

"repository": {
    "type": "git","url": "git://github.com/github.com/carmendata/core-js.git"
  },

应该在什么时候

"repository": {
    "type": "git","url": "https://github.com/carmendata/core-js.git"
  },
本文链接:https://www.f2er.com/2704112.html

大家都在问