无法在 MAC OSX 10.12.6 上通过 npm 安装 firebase-tools(错误:在解析"...x ","火力基地 ":" ~1.0.1)



>我当前正在使用节点版本10.10.0npm 版本 6.4.1尝试安装 firebase CLI 以处理已创建的 firebase 项目的云功能。它在其他系统上工作正常,但无法在我的MAC上安装Firebase工具。我还安装了新版本的node,希望纠正此错误,但没有帮助。我还尝试使用带有 npm 的"sudo"和"--force"进行安装,但它也没有帮助。这是我得到的错误的完整日志。请帮忙 这是错误日志

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 ]

基于以下行:

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以将其重置。

或者,您可以尝试运行命令来重置缓存。

最新更新