繁体   English   中英

无法安装浪涌

[英]Unable to install Surge

我正在尝试使用命令通过 npm 安装浪涌

npm install -g surge

但它抛出以下错误

npm 错误。 JSON 输入意外结束,同时在 '...<2.0,0":"ecc-jsbn":">' 附近解析

npm ERR:此运行的完整日志可在 npm ERR 中找到。 /.npm/_logs/2019-09-28T07_05_28_294Z-debug.log

以下任何线索?

检查日志文件后,看到以下内容(抱歉,大量日志)

>0 info it worked if it ends with ok
>1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'surge' ]
2 info using npm@6.9.0
3 info using node@v10.16.3
4 verbose npm-session 5401a8f4e3b6d38a
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npmjs.org/surge 317ms (from cache)
8 silly pacote tag manifest for surge@latest fetched in 360ms
9 timing stage:loadCurrentTree Completed in 395ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 2ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule surge@0.21.3 checking installable status
17 http fetch GET 304 https://registry.npmjs.org/cli-table3 97ms (from cache)
18 silly pacote range manifest for cli-table3@^0.5.1 fetched in 108ms
19 silly resolveWithNewModule cli-table3@0.5.1 checking installable status
20 http fetch GET 304 https://registry.npmjs.org/request 73ms (from cache)
21 silly pacote range manifest for request@^2.88.0 fetched in 86ms
22 silly resolveWithNewModule request@2.88.0 checking installable status
23 http fetch GET 304 https://registry.npmjs.org/netrc 223ms (from cache)

……

 329 silly pacote range manifest for safe-buffer@^5.1.2 fetched in 98ms
    330 silly resolveWithNewModule safe-buffer@5.2.0 checking installable status
    331 silly pacote range manifest for uuid@^3.3.2 fetched in 93ms
    332 silly resolveWithNewModule uuid@3.3.3 checking installable status
    333 http fetch GET 304 https://registry.npmjs.org/delayed-stream 65ms (from cache)
    334 silly pacote range manifest for delayed-stream@~1.0.0 fetched in 69ms
    335 silly resolveWithNewModule delayed-stream@1.0.0 checking installable status
    336 http fetch GET 304 https://registry.npmjs.org/asynckit 69ms (from cache)
    337 silly pacote range manifest for asynckit@^0.4.0 fetched in 71ms
    338 silly resolveWithNewModule asynckit@0.4.0 checking installable status
    339 http fetch GET 304 https://registry.npmjs.org/mime-db 71ms (from cache)
    340 silly pacote version manifest for mime-db@1.40.0 fetched in 75ms
    341 silly resolveWithNewModule mime-db@1.40.0 checking installable status
    342 http fetch GET 304 https://registry.npmjs.org/har-schema 76ms (from cache)
    343 silly pacote range manifest for har-schema@^2.0.0 fetched in 81ms
    344 silly resolveWithNewModule har-schema@2.0.0 checking installable status
    345 http fetch GET 304 https://registry.npmjs.org/ajv 114ms (from cache)
    346 silly pacote range manifest for ajv@^6.5.5 fetched in 124ms
    347 silly resolveWithNewModule ajv@6.10.2 checking installable status
    348 http fetch GET 304 https://registry.npmjs.org/json-schema-traverse 74ms (from cache)
    349 http fetch GET 304 https://registry.npmjs.org/fast-json-stable-stringify 76ms (from cache)
    350 http fetch GET 304 https://registry.npmjs.org/uri-js 76ms (from cache)
    351 silly pacote range manifest for json-schema-traverse@^0.4.1 fetched in 77ms
    352 silly resolveWithNewModule json-schema-traverse@0.4.1 checking installable status
    353 silly pacote range manifest for fast-json-stable-stringify@^2.0.0 fetched in 82ms
    354 silly resolveWithNewModule fast-json-stable-stringify@2.0.0 checking installable status
    355 silly pacote range manifest for uri-js@^4.2.2 fetched in 81ms
    356 silly resolveWithNewModule uri-js@4.2.2 checking installable status
    357 http fetch GET 304 https://registry.npmjs.org/fast-deep-equal 84ms (from cache)
    358 silly pacote range manifest for fast-deep-equal@^2.0.1 fetched in 85ms
    359 silly resolveWithNewModule fast-deep-equal@2.0.1 checking installable status
    360 http fetch GET 304 https://registry.npmjs.org/punycode 86ms (from cache)
    361 silly pacote range manifest for punycode@^2.1.0 fetched in 89ms
    362 silly resolveWithNewModule punycode@2.1.1 checking installable status
    363 http fetch GET 304 https://registry.npmjs.org/assert-plus 75ms (from cache)
    364 silly pacote range manifest for assert-plus@^1.0.0 fetched in 77ms
    365 silly resolveWithNewModule assert-plus@1.0.0 checking installable status
    366 http fetch GET 304 https://registry.npmjs.org/jsprim 78ms (from cache)
    367 http fetch GET 304 https://registry.npmjs.org/sshpk 78ms (from cache)
    368 silly fetchPackageMetaData error for sshpk@^1.7.0 Unexpected end of JSON input while parsing near '...<2.0.0","ecc-jsbn":">'
    369 silly pacote range manifest for jsprim@^1.2.2 fetched in 81ms
    370 silly resolveWithNewModule jsprim@1.4.1 checking installable status
    371 timing stage:rollbackFailedOptional Completed in 1ms
    372 timing stage:runTopLevelLifecycles Completed in 4344ms
    373 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...<2.0.0","ecc-jsbn":">'
    373 verbose stack     at JSON.parse (<anonymous>)
    373 verbose stack     at parseJson (/usr/local/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
    373 verbose stack     at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
    373 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
    374 verbose cwd /Users/ym
    375 verbose Darwin 18.7.0
    376 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "surge"
    377 verbose node v10.16.3
    378 verbose npm  v6.9.0
    379 error Unexpected end of JSON input while parsing near '...<2.0.0","ecc-jsbn":">'
    380 verbose exit [ 1, true ]

Npm 使用缓存为您下载新包。 您需要清除 npm 缓存。 使用以下命令进行清理:

以管理员身份打开终端

npm uninstall -g surge
npm cache clean --force

然后运行

npm install -g surge

这对我有用!

在某些时候似乎只是一个下载错误,你应该再试一次安装它。

这在我的情况下不起作用。 请提供任何其他选项。 谢谢。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM