node.js - 安装 react-native-elements 时出现 NPM 错误
问题描述
我想react-native-elements
为我的应用程序安装,但是在 cmd 提示符下输入安装命令后,它给出了这个错误:
npm ERR! Unexpected end of JSON input while parsing near '...webpack-loader":"^3.3'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\DE\AppData\Roaming\npm-cache\_logs\2020-04-11T06_21_21_206Z-debug.log
而在2020-04-11T06_21_21_206Z-debug.log
0 info it worked if it ends with ok
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 'install',
1 verbose cli '--save',
1 verbose cli 'react-native-elements' ]
2 info using npm@5.6.0
3 info using node@v8.11.1
4 verbose npm-session 19d809f3b42b5934
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/react-native-elements 656ms (from cache)
8 silly fetchPackageMetaData error for react-native-elements@latest Unexpected end of JSON input while parsing near '...webpack-loader":"^3.3'
9 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...webpack-loader":"^3.3'
9 verbose stack at JSON.parse (<anonymous>)
9 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\node_modules\json-parse-better-errors\index.js:7:17)
9 verbose stack at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\body.js:96:50)
9 verbose stack at <anonymous>
9 verbose stack at process._tickCallback (internal/process/next_tick.js:188:7)
10 verbose cwd E:\Project\test
11 verbose Windows_NT 10.0.17134
12 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "react-native-elements"
13 verbose node v8.11.1
14 verbose npm v5.6.0
15 error Unexpected end of JSON input while parsing near '...webpack-loader":"^3.3'
16 verbose exit [ 1, true ]
所有其他库都安装成功。只是react-native-elements
给出错误。
解决方案
第一次尝试
npm cache clean --force
然后安装 react-native-elements
npm install react-native-elements
推荐阅读
- yaml - 如何比较两个 OpenAPI 3.x YAML 文件?
- sql - postgres 查询写作从我的表中查找哪个人超过了计划的工作时间
- .net - 在 WinForms WebBrowser 控件中设置常规文本大小选项
- android - 在图像上叠加透明视频并在 android 中使用 FFmpeg 导出为 GIF
- postgresql - 在 postgresql 中查找辅助键的重复项
- javascript - 无法让 vue3-google-map 在 codepen 中工作
- typescript - 如何根据联合类型的通用扩展键缩小类型
- vb.net - 我需要从时间报表列表中提取工作时间休息 [C# | VB.Net]
- questdb - 从不同 IP 到 QuestDB 的同时读取限制?
- anychart - AnyGantt 阻止计算孩子的父母日期