I am trying to setup firebase Command line interface(CLI) in windows 10, I used the below command to install firebase tools

npm install -g firebase-tools

But my installation get failed saying

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

Log says

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 ]

Can anyone help me out with this ?

1 Answers

1
Fotios Tragopoulos On Best Solutions

Node and NPM have newer versions. Try updating them, it may solve the issue.

Then run

npm cache clean --force