當我運行npm publish它時顯示 415 Unsupported Media Type - PUT https://registry.npmjs.org/json-to-plain-text - No package.json found in tarball
不知道為什么會這樣,我的電腦有問題嗎?我正在使用帶有 nodejs 版本 v12.22.5 和 npm 版本 7.5.2 的 parrot OS
~$ cat /home/sumith/.npm/_logs/2022-03-21T16_14_00_789Z-debug.log
0 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'publish' ]
1 info using npm@7.5.2
2 info using node@v12.22.5
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:/usr/share/nodejs/npm/npmrc Completed in 1ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 1ms
8 timing config:load:file:/home/sumith/repos/json-to-plain-text/.npmrc Completed in 0ms
9 timing config:load:project Completed in 0ms
10 timing config:load:file:/home/sumith/.npmrc Completed in 1ms
11 timing config:load:user Completed in 1ms
12 timing config:load:file:/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 1ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 7ms
19 verbose npm-session 7f303ef810561d7f
20 timing npm:load Completed in 14ms
21 verbose publish [ '.' ]
22 notice
23 notice ?? json-to-plain-text@1.0.3
24 notice === Tarball Contents ===
25 notice 11B /.gitattributes
25 notice 4B /.prettierignore
25 notice 96B /.prettierrc.json
25 notice 3.7kB /index.js
25 notice 7B /json-to-plain-text.version
25 notice 1.5kB /lib/helper.js
25 notice 4.3kB /lib/lib.js
25 notice 1.1kB /LICENSE
25 notice 638B /package.json
25 notice 3.4kB /README.md
25 notice 988B /test/test.js
26 notice === Tarball Details ===
27 notice name: json-to-plain-text
27 notice version: 1.0.3
27 notice filename: json-to-plain-text-1.0.3.tgz
27 notice package size: 4.1 kB
27 notice unpacked size: 15.8 kB
27 notice shasum: 886d5f0bfcdf85d3755e3dcfc4c7efab1168b9be
27 notice integrity: sha512-fMvvgpV7nQ1pn[...]Cl4fiZJJbe1rg==
27 notice total files: 11
28 notice
29 http fetch PUT 415 https://registry.npmjs.org/json-to-plain-text 1839ms
30 timing command:publish Completed in 1905ms
31 verbose stack Error: 415 Unsupported Media Type - PUT https://registry.npmjs.org/json-to-plain-text - No package.json found in tarball
31 verbose stack at /usr/share/nodejs/npm/node_modules/npm-registry-fetch/check-response.js:123:15
31 verbose stack at async publish (/usr/share/nodejs/npm/node_modules/libnpmpublish/publish.js:43:12)
31 verbose stack at async publish_ (/usr/share/nodejs/npm/lib/publish.js:120:5)
31 verbose stack at async publish (/usr/share/nodejs/npm/lib/publish.js:43:19)
32 verbose statusCode 415
33 verbose pkgid json-to-plain-text@1.0.3
34 verbose cwd /home/sumith/repos/json-to-plain-text
35 verbose Linux 5.16.0-12parrot1-amd64
36 verbose argv "/usr/bin/node" "/usr/bin/npm" "publish"
37 verbose node v12.22.5
38 verbose npm v7.5.2
39 error code E415
40 error 415 Unsupported Media Type - PUT https://registry.npmjs.org/json-to-plain-text - No package.json found in tarball
41 verbose exit 1
uj5u.com熱心網友回復:
有同樣的問題。這是我的猜測,但我懷疑這是 NPM 注冊表服務器端的問題。'package.json' 顯然被壓縮了,如'Tarball Contents' 部分所示。npm cli 向 NPM 服務器 (registry.npmjs.org) 發出了請求,但由于某種原因,npm 注冊表上的代碼拒絕了 tarball,并且要么在沒有問題的情況下診斷問題,要么告訴我們有問題但是誤診。但要更加確定,也許先嘗試 'npm pack',然后使用 'tar -tzvf json-to-plain-text-1.0.3.tgz' 檢查 tarball 內容,然后使用 'npm publish json-to-plain -text-1.0.3.tgz'?
非易失性。我現在知道答案了。事實證明 nodejs 12 有點過時了。嘗試使用此方法使用 nodejs v17 。我個人認為Debian 存盤庫的落后是有錯的。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/448487.html
上一篇:模塊網路作業者解決方法
下一篇:電子“準備展示”事件未按預期作業
