Firebase - 在 Windows 的 Firebase CLI 中设置时出错

Firebase - Error while setup in Firebase CLI in Windows

我正在尝试在 windows 10 中设置 firebase 命令行界面 (CLI),我使用以下命令安装 firebase 工具

npm install -g firebase-tools

但是我安装失败说

npm ERR! Unexpected end of JSON input while parsing near '..."./bin/express"},"dir'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\raj kumar\AppData\Roaming\npm-cache\_logs19-05-11T04_40_26_201Z-debug.log

日志显示

148 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '..."./bin/express"},"dir'
148 verbose stack     at JSON.parse (<anonymous>)
148 verbose stack     at parseJson (C:\snapshot\firepit\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
148 verbose stack     at Body.json.consumeBody.call.then.buffer (C:\snapshot\firepit\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\body.js:96:50)
148 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
149 verbose cwd C:\Users\raj kumar\Downloads
150 verbose Windows_NT 10.0.16299
151 verbose argv "C:\Users\RAJKUM~1\DOWNLO~1\firebase-cli.exe" "C:\snapshot\firepit\node_modules\npm\bin\npm-cli" "--script-shell=C:\Users\RAJKUM~1\CACHE~1\firebase\bin/shell.bat" "--globalconfig=C:\Users\RAJKUM~1\CACHE~1\firebase\bin\npmrc" "install" "-g" "--verbose" "npm" "firebase-tools"
152 verbose node v10.4.1
153 verbose npm  v6.1.0
154 error Unexpected end of JSON input while parsing near '..."./bin/express"},"dir'
155 verbose exit [ 1, true ]

谁能帮我解决这个问题?

Node 和 NPM 有更新的版本。尝试更新它们,它可能会解决问题。

然后运行

npm cache clean --force