简体   繁体   中英

Unable to do “npm install --save firebase”

I have used firebase right up to yesterday morning, then suddenly in the afternoon "npm install --save firebase" stopped working with the error:

npm ERR. Unexpected end of JSON input while parsing near '...anary.9678bf9,tgz","f'

npm ERR: A complete log of this run can be found in: npm ERR!
C:\Users\manjot\AppData\Roaming\npm-cache_logs\2019-11-04T05_47_36_550Z-debug.log

I've tried updating my node.js from 10 to 13.0.1, uninstalling and installing, clearing cache, restarting my computer, a new project, doing all of this with admin cmd, googled a bit but no luck so far. Why did it suddenly stop working and how to fix this issue? I can still do things like

"npm install --save react-navigation"

or

"npm install --save react-navigation-stack"

Looks like the latest released version of firebase npm module is corrupted somehow and npm is failing to parse the tgz file for the lib. If it was me I would go and look at their releases page look for a previous version you know works and install that version.

npm install firebase@xyz for example

I would also say, be sure to use a package-lock.json file to lock down working versions of modules.

The same problem happened to me one day.

  • Delete the npm_modules directory

  • run npm install command

It worked for me!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM