I am currently using node version 10.10.0 and npm version 6.4.1 Trying to install firebase CLI to work on cloud functions for the firebase project already created. It is working fine on other systems but is unable to install firebase-tools on my MAC. I have also installed a fresh version of node in hope of getting this error rectified but it did not help. I also tried using 'sudo' and '--force' with npm to install but it also did not help. Here is a complete log of the error i got. Please help Here is the error log
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 ]