通过 npm 安装 firebase 时遇到错误 |解析 near 时 JSON 输入意外结束
Facing error while installing firebase via npm | Unexpected end of JSON input while parsing near
我正在尝试在我的新 React 项目中安装 firebase,但我无法安装它。
无论是错误还是 npm 正在耗时。我等了半个多小时
试试这个(您可能需要 运行 sudo
或者如果您使用的是 Windows,请以管理员身份打开 cmd
。
npm cache clean --force
然后 运行
npm install firebase
虽然上述答案似乎适用于大多数情况,但我的情况并非如此。
我试过了
npm cache clean -f
npm install firebase
运气不好!
我关注了 ,它解释了很多关于 npm 缓存的内容,这也得出结论,上述方法应该有效,也许只是在安装 firebase 之前验证缓存
npm cache clean -f
npm install firebase
npm verify cache
仍然,运气不好,所以我决定将它添加到 package.json 中,作为对最新稳定版 firebase (8.0.0) 的依赖。
所以转到 package.json 文件并在依赖项部分
"dependencies": {
"firebase": "^8.0.0",
...other dependencies
}
并做
npm cache clean -f
npm install npm@latest
这应该适用于类似的情况,请查看 以详细了解 npm 上的缓存是如何工作的。
我正在尝试在我的新 React 项目中安装 firebase,但我无法安装它。
无论是错误还是 npm 正在耗时。我等了半个多小时
试试这个(您可能需要 运行 sudo
或者如果您使用的是 Windows,请以管理员身份打开 cmd
。
npm cache clean --force
然后 运行
npm install firebase
虽然上述答案似乎适用于大多数情况,但我的情况并非如此。 我试过了
npm cache clean -f
npm install firebase
运气不好!
我关注了
npm cache clean -f
npm install firebase
npm verify cache
仍然,运气不好,所以我决定将它添加到 package.json 中,作为对最新稳定版 firebase (8.0.0) 的依赖。
所以转到 package.json 文件并在依赖项部分
"dependencies": {
"firebase": "^8.0.0",
...other dependencies
}
并做
npm cache clean -f
npm install npm@latest
这应该适用于类似的情况,请查看