我目前正在使用节点10.10.0版和NPMVersion6.4.1试图安装firebase,以便为已经创建的firebase项目处理云功能。它在其他系统上运行良好,但无法在我的MAC上安装防火墙工具。我也安装了一个新版本的节点,希望得到纠正错误,但它没有帮助。我也尝试使用'sudo‘和’-force‘与npm一起安装,但也没有帮助。这是我得到的错误的完整日志。请帮助这里是错误日志
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/10.10.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'firebase-tools' ]
2 info using npm@6.4.1
3 info using node@v10.10.0
4 verbose npm-session 402be1d1b21d5c2d
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npmjs.org/firebase-tools 297ms (from cache)
8 silly fetchPackageMetaData error for firebase-tools@latest Unexpected end of JSON input while parsing near '...x","firebase":"~1.0.1'
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 477ms
11 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...x","firebase":"~1.0.1'
11 verbose stack at JSON.parse (<anonymous>)
11 verbose stack at parseJson (/usr/local/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
11 verbose stack at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
11 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
12 verbose cwd /Users/techienimi
13 verbose Darwin 16.7.0
14 verbose argv "/usr/local/Cellar/node/10.10.0/bin/node" "/usr/local/bin/npm" "install" "-g" "firebase-tools"
15 verbose node v10.10.0
16 verbose npm v6.4.1
17 error Unexpected end of JSON input while parsing near '...x","firebase":"~1.0.1'
18 verbose exit [ 1, true ]发布于 2018-09-08 16:16:43
根据这些行文:
7 http fetch GET 304 https://registry.npmjs.org/firebase-tools 297ms (from cache)
8 silly fetchPackageMetaData error for firebase-tools@latest Unexpected end of JSON input while parsing near '...x","firebase":"~1.0.1'听起来你的npm缓存可能已经损坏了。尝试删除主目录中的目录.npm来重置它。
或者,你可以尝试运行一个命令来重置缓存。
https://stackoverflow.com/questions/52232408
复制相似问题