Firebase-无法使用npm安装firebase,但是yarn可以工作 [英] Firebase - Failing to install firebase using npm but yarn works

查看:88
本文介绍了Firebase-无法使用npm安装firebase,但是yarn可以工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

λ npm -g install firebase
npm ERR! Unexpected end of JSON input while parsing near '...9gwBD9c+ThTWWmNBXcfJZ'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\2nchy\AppData\Roaming\npm-cache\_logs\2020-07-13T18_19_46_173Z-debug.log

我将 .npmrc中的超时秒数增加到12,000 ,并将 npm降级到6.3.17 ,按照建议清除了缓存,甚至从空目录,但仍然收到几乎相同的错误

I increased timeout seconds in .npmrc to 12,000 and downgraded npm to 6.3.17, cleared the cache as it was suggested and even installed it from an empty directory but still getting an almost same error

更新卸载并重新安装nodejs.这是日志:

UPDATE Uninstalled nodejs and resinstalled. This is the log:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   '-g',
1 verbose cli   'install',
1 verbose cli   'firebase'
1 verbose cli ]
2 info using npm@6.14.4
3 info using node@v12.16.3
4 verbose npm-session 73d31a98f2671f49
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/firebase 5152ms
8 silly fetchPackageMetaData error for firebase@latest Unexpected end of JSON input while parsing near '....0"},"dist":{"shasum"'
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 5197ms
11 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '....0"},"dist":{"shasum"'
11 verbose stack     at JSON.parse (<anonymous>)
11 verbose stack     at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
11 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50
11 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
12 verbose cwd C:\Users\2nchy\Desktop\firetrial
13 verbose Windows_NT 10.0.17763
14 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "-g" "install" "firebase"
15 verbose node v12.16.3
16 verbose npm  v6.14.4
17 error Unexpected end of JSON input while parsing near '....0"},"dist":{"shasum"'
18 verbose exit [ 1, true ]

推荐答案

我遇到了同样的问题;这是因为我在同一项目 yarn npm 中使用了不同的程序包管理器使用其中任何一个对我都有效.

I was having the same problem; it arised for me because I was using different package managers in the same project yarn and npm Using either one of them worked for me.

这篇关于Firebase-无法使用npm安装firebase,但是yarn可以工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆