首页 > 解决方案 > 工件注册表文件中的“自述文件”字段来自哪里

问题描述

我们在 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 注册表添加的,还是包作者添加的,还是其他的?

有没有办法摆脱那个领域?

标签: typescriptnpmazure-pipelinesazure-artifacts

解决方案


上述错误可能是由缓存错误或错误的 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如果上述解决方案无法修复错误,您可以检查您的包裹中驻留的位置是否有错误。

您可以参考此线程以获取更多信息


推荐阅读