typescript - 工件注册表文件中的“自述文件”字段来自哪里
问题描述
我们在 Azure 上有私有的 npm 注册表,我们有自己的 npm 包。它还存储 npmjs 包,其中之一是@typescript-eslint/parser
我们注意到管道在npm install
任务中失败SyntaxError: Unexpected end of JSON input...
2020-03-30T14:10:52.6744568Z npm http fetch GET 200 https:/EDITED.pkgs.visualstudio.com/_packaging/EDITED-Artifacts/npm/registry/@typescript-eslint%2fparser 216884ms
2020-03-30T14:10:52.6745003Z npm verb teardown shutting down workers.
2020-03-30T14:10:52.6745278Z npm info teardown Done in 0s
2020-03-30T14:10:52.6745630Z npm verb stack SyntaxError: Unexpected end of JSON input while parsing near '...odebase, don't forget'
2020-03-30T14:10:52.6746036Z npm verb stack at JSON.parse (<anonymous>)
2020-03-30T14:10:52.6746533Z npm verb stack at parseJson (C:\temp\_work\_tool\node\8.17.0\x64\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
2020-03-30T14:10:52.6747277Z npm verb stack at consumeBody.call.then.buffer (C:\temp\_work\_tool\node\8.17.0\x64\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
2020-03-30T14:10:52.6747811Z npm verb stack at <anonymous>
2020-03-30T14:10:52.6748134Z npm verb stack at process._tickCallback (internal/process/next_tick.js:189:7)
2020-03-30T14:10:52.6748474Z npm verb cwd C:\temp\_work\4\s
2020-03-30T14:10:52.6748696Z npm verb Windows_NT 10.0.18362
2020-03-30T14:10:52.6749157Z npm verb argv "C:\\temp\\_work\\_tool\\node\\8.17.0\\x64\\node.exe" "C:\\temp\\_work\\_tool\\node\\8.17.0\\x64\\node_modules\\npm\\bin\\npm-cli.js" "ci"
2020-03-30T14:10:52.6749618Z npm verb node v8.17.0
2020-03-30T14:10:52.6749914Z npm verb npm v6.13.4
2020-03-30T14:10:52.6750208Z npm ERR! Unexpected end of JSON input while parsing near '...odebase, don't forget'
2020-03-30T14:10:52.6750526Z npm verb exit [ 1, true ]
我们注意到这个包描述文件包含的readme
字段大大增加了它的大小(@typescript-eslint%2fparser
描述 JSON 是 5.5MB,从readme
字段中剥离出来只有 1.5MB)。这个字段是由 Azure 注册表添加的,还是包作者添加的,还是其他的?
有没有办法摆脱那个领域?
解决方案
上述错误可能是由缓存错误或错误的 package-lock.json 文件引起的。
您可以尝试npm cache clean --force
在 npm install 软件包之前运行。
npm cache clean --force
npm install -g @typescript-eslint/parser
如果它仍然不起作用,请尝试删除 package-lock.json 文件。
...odebase, don't forget
如果上述解决方案无法修复错误,您可以检查您的包裹中驻留的位置是否有错误。
您可以参考此线程以获取更多信息
推荐阅读
- r - 多次在矩阵上重复一个函数并对结果矩阵求和
- tls1.2 - 支持 TLS v1.2 的 AWS SDK 版本是多少?
- java - Spring 中 Servlet 过滤器的内部工作原理
- docker - 为什么`chmod`会导致`docker build`耗尽磁盘空间
- vba - 在单独的文件中拆分 Access 数据库
- regex - 在 perl 中只打印匹配的字符
- prometheus - 如何划分两个 Prometheus 计数器
- javascript - 使用 WebRTC 时不立即显示视频
- xamarin.forms - FreshMVVM - 从不继承 FreshBasePageModel 的子 ContentView 打开页面的最佳方式
- windows - 如何为没有任何依赖关系的 Windows EXE 文件从头开始创建 Dockerfile?