NPM 无法发布 E400 新软件包版本必须具有 {shasum, tarball} 的 dist

NPM Can't Publish E400 New package version must have dist with {shasum, tarball}

我遇到这个问题,突然之间我无法再发布到 npm。

当 运行 npm publish

时出现以下错误

NPM Can't Publish E400 New package version must have dist with {shasum, tarball}

我不知道我能做些什么,而且我在互联网上什么也找不到。我确实在另一个 mac 上做了一个 npm 次要版本,忘记了 npm 发布。所以我尝试从不同的 mac 发布。但是我尝试创建一个补丁版本,但仍然遇到同样的错误。有帮助吗?我附上了下面的日志。

此文件不存在

/var/folders/b1/qwvr4ldn1_375rkwn7yhyk4m0000gn/T/npm-6060-1b2f34a9/tmp/fromDir-157455b2/package.tgz

但是我不知道如何创建它,我尝试删除标签和提交并再次执行 npm version minor。它工作正常,但是当我之后执行 npm publish 时,我再次遇到同样的错误。

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/9.8.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'publish' ]
2 info using npm@5.6.0
3 info using node@v9.8.0
4 verbose npm-session 009a09b3734b2310
5 verbose publish [ '.' ]
6 info lifecycle html5sortable@0.8.0~prepublish: html5sortable@0.8.0
7 info lifecycle html5sortable@0.8.0~prepare: html5sortable@0.8.0
8 info lifecycle html5sortable@0.8.0~prepublishOnly: html5sortable@0.8.0
9 info lifecycle html5sortable@0.8.0~prepack: html5sortable@0.8.0
10 info lifecycle html5sortable@0.8.0~postpack: html5sortable@0.8.0
11 verbose getPublishConfig undefined
12 silly mapToRegistry name html5sortable
13 silly mapToRegistry using default registry
14 silly mapToRegistry registry https://registry.npmjs.org/
15 silly mapToRegistry data { type: 'tag',
15 silly mapToRegistry   registry: true,
15 silly mapToRegistry   where: undefined,
15 silly mapToRegistry   raw: 'html5sortable',
15 silly mapToRegistry   name: 'html5sortable',
15 silly mapToRegistry   escapedName: 'html5sortable',
15 silly mapToRegistry   scope: undefined,
15 silly mapToRegistry   rawSpec: '',
15 silly mapToRegistry   saveSpec: null,
15 silly mapToRegistry   fetchSpec: 'latest',
15 silly mapToRegistry   gitRange: undefined,
15 silly mapToRegistry   gitCommittish: undefined,
15 silly mapToRegistry   hosted: undefined }
16 silly mapToRegistry uri https://registry.npmjs.org/html5sortable
17 verbose publish registryBase https://registry.npmjs.org/
18 silly publish uploading /var/folders/b1/qwvr4ldn1_375rkwn7yhyk4m0000gn/T/npm-6060-1b2f34a9/tmp/fromDir-157455b2/package.tgz
19 verbose request uri https://registry.npmjs.org/html5sortable
20 verbose request sending authorization for write operation
21 info attempt registry request try #1 at 1:09:12 PM
22 verbose request using bearer token for auth
23 verbose request id gda9f5bf7619f2e
24 http request PUT https://registry.npmjs.org/html5sortable
25 http 400 https://registry.npmjs.org/html5sortable
26 verbose headers { 'content-type': 'application/json',
26 verbose headers   'cache-control': 'max-age=300',
26 verbose headers   'content-length': '86',
26 verbose headers   'accept-ranges': 'bytes',
26 verbose headers   date: 'Sat, 10 Mar 2018 12:09:12 GMT',
26 verbose headers   via: '1.1 varnish',
26 verbose headers   connection: 'keep-alive',
26 verbose headers   'x-served-by': 'cache-hhn1520-HHN',
26 verbose headers   'x-cache': 'MISS',
26 verbose headers   'x-cache-hits': '0',
26 verbose headers   'x-timer': 'S1520683750.327475,VS0,VE1855',
26 verbose headers   vary: 'Accept-Encoding, Accept' }
27 error publish Failed PUT 400
28 verbose stack Error: New package version must have dist with {shasum, tarball}. : html5sortable
28 verbose stack     at makeError (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:314:12)
28 verbose stack     at RegClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:302:14)
28 verbose stack     at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:216:14)
28 verbose stack     at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:186:22)
28 verbose stack     at Request.emit (events.js:180:13)
28 verbose stack     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1163:10)
28 verbose stack     at Request.emit (events.js:180:13)
28 verbose stack     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1085:12)
28 verbose stack     at Object.onceWrapper (events.js:272:13)
28 verbose stack     at IncomingMessage.emit (events.js:185:15)
28 verbose stack     at endReadableNT (_stream_readable.js:1101:12)
28 verbose stack     at process._tickCallback (internal/process/next_tick.js:114:19)
29 verbose statusCode 400
30 verbose pkgid html5sortable
31 verbose cwd /Users/lukasoppermann/Code/html5sortable
32 verbose Darwin 16.7.0
33 verbose argv "/usr/local/Cellar/node/9.8.0/bin/node" "/usr/local/bin/npm" "publish"
34 verbose node v9.8.0
35 verbose npm  v5.6.0
36 error code E400
37 error New package version must have dist with {shasum, tarball}. : html5sortable
38 verbose exit [ 1, true ]

我的 package.json 中有一个 dist 字段干扰了发布过程。所以删除它解决了一切。

你可以试试,

ng init

你有字段 package.json