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

时间:2019-05-11 04:53:21

标签: firebase firebase-cli

我正在尝试在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\_logs\2019-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 ]

有人可以帮我吗?

1 个答案:

答案 0 :(得分:1)

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

然后运行

npm cache clean --force