解析附近时 JSON 中位置 XXX 出现意外标记的错误

2024-01-11

I npm install在一个目录上package.json对于我的公司项目。然而,它不断给我带来各种错误 Unexpected token in JSON at position....

我已经做好了npm cache clean --force, npm cache verify等等,按照建议当我运行“npm install”时,它返回“ERR!”代码 EINTEGRITY` (npm 5.3.0) https://stackoverflow.com/questions/47545940/when-i-run-npm-install-it-returns-with-err-code-eintegrity-npm-5-3-0

然而,问题仍然存在。但我没有配置代理,因为我的机器不在任何公司代理上。

不管怎样,我附上npm日志内容和package.json文件内容供大家参考。请帮助告诉我出了什么问题以及如何解决这个问题。

npm log:

122 silly pacote range manifest for array-includes@^3.1.1 fetched in 64ms
123 http fetch GET 304 https://registry.npmjs.org/typescript 459ms (from cache)
124 silly pacote range manifest for popper.js@^1.14.1 fetched in 109ms
125 warn deprecated [email protected] /cdn-cgi/l/email-protection: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
126 silly fetchPackageMetaData error for typescript@^3.8.3 Unexpected token  in JSON at position 831531 while parsing near '...k+EIAF5TJm/AB3lmH1Ƃ�,Xj��ZY��x4YSZvSI...'
127 http fetch GET 304 https://registry.npmjs.org/array.prototype.flat 96ms (from cache)
128 silly pacote range manifest for array.prototype.flat@^1.2.3 fetched in 99ms
129 http fetch GET 304 https://registry.npmjs.org/contains-path 94ms (from cache)
130 silly pacote range manifest for contains-path@^0.1.0 fetched in 95ms
131 http fetch GET 304 https://registry.npmjs.org/debug 85ms (from cache)
132 http fetch GET 304 https://registry.npmjs.org/doctrine 75ms (from cache)
133 silly pacote range manifest for debug@^2.6.9 fetched in 89ms
134 silly pacote version manifest for [email protected] /cdn-cgi/l/email-protection fetched in 79ms
...
307 http fetch GET 304 https://registry.npmjs.org/rxjs 71ms (from cache)
308 silly fetchPackageMetaData error for rxjs@^6.6.0 Unexpected token    in JSON at position 133105 while parsing near '...\r\n-----END PGP8'�� C��m�4���
r\n"},"e...'
309 silly pacote range manifest for through@^2.3.6 fetched in 60ms
310 http fetch GET 304 https://registry.npmjs.org/deep-is 51ms (from cache)
...
479 silly pacote range manifest for typescript-eslint-parser@^18.0.0 fetched in 9ms
480 silly resolveWithNewModule [email protected] /cdn-cgi/l/email-protection checking installable status
481 http fetch GET 304 https://registry.npmjs.org/typescript 67ms (from cache)
482 silly fetchPackageMetaData error for typescript@^3.8.3 Unexpected token  in JSON at position 831531 while parsing near '...k+EIAF5TJm/AB3lmH1Ƃ�,Xj��ZY��x4YSZvSI...'
483 timing stage:rollbackFailedOptional Completed in 1ms
484 timing stage:runTopLevelLifecycles Completed in 2633ms
485 silly saveTree [email protected] /cdn-cgi/l/email-protection
...
485 silly saveTree ├── [email protected] /cdn-cgi/l/email-protection
485 silly saveTree └── [email protected] /cdn-cgi/l/email-protection
486 verbose stack SyntaxError: Unexpected token  in JSON at position 831531 while parsing near '...k+EIAF5TJm/AB3lmH1Ƃ�,Xj��ZY��x4YSZvSI...'
486 verbose stack     at JSON.parse (<anonymous>)
486 verbose stack     at parseJson (/usr/local/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
486 verbose stack     at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
486 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
487 verbose cwd /home/rugrat/Projects/aleng/ui/includes
488 verbose Linux 4.4.0-189-generic
489 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "install"
490 verbose node v10.22.0
491 verbose npm  v6.14.8
492 error Unexpected token  in JSON at position 831531 while parsing near '...k+EIAF5TJm/AB3lmH1Ƃ�,Xj��ZY��x4YSZvSI...'
493 verbose exit [ 1, true ]

包.json:

{
  "name": "typescript-type-definitions",
  "version": "1.0.0",
  "description": "Type definitions for TypeScript",
  "main": "typescript/main.js",
  "dependencies": {},
  "devDependencies": {
    "@types/bootbox": "^4.4.36",
    "@types/bootstrap": "^4.3.2",
    "@types/bootstrap-3-typeahead": "^4.0.1",
    "@types/bootstrap-select": "^1.11.1",
    "@types/bootstrap-switch": "0.0.31",
    "@types/bootstrap-toggle": "^2.2.1",
    "@types/bootstrap-treeview": "^1.20.0",
    "@types/d3": "^5.7.2",
    "@types/datatables.net": "^1.10.19",
    "@types/datatables.net-select": "^1.2.6",
    "@types/jquery": "^1.10.35",
    "@types/jquerymobile": "^1.4.30",
    "@types/jqueryui": "^1.12.8",
    "@types/x-editable": "^1.5.29",
    "apidoc": "^0.25.0",
    "eslint": "^6.8.0",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-typescript": "^0.12.0",
    "prettier": "^1.19.1",
    "typescript": "^3.8.3",
    "typescript-eslint-parser": "^18.0.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "XXX XXX",
  "license": "ISC"
}

我还添加了输出npm config and npm config ls -l below.

输出为npm config:

; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.14.8 node/v10.22.0 linux x64"

; builtin config undefined
globalconfig = "/etc/npmrc"
globalignorefile = "/etc/npmignore"
prefix = "/usr/local"

; node bin location = /usr/bin/node
; cwd = /home/myname
; HOME = /home/myname
; "npm config ls -l" to show all defaults.

输出npm config ls -l:

; cli configs
long = true
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.14.8 node/v10.22.0 linux x64"

; builtin config undefined
globalconfig = "/etc/npmrc"
globalignorefile = "/etc/npmignore"
prefix = "/usr/local"

; default values
access = null
allow-same-version = false
also = null
always-auth = false
audit = true
audit-level = "low"
auth-type = "legacy"
before = null
bin-links = true
browser = null
ca = null
cache = "/home/myname/.npm"
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = null
cache-min = 10
cafile = undefined
cert = null
cidr = null
color = true
commit-hooks = true
depth = null
description = true
dev = false
dry-run = false
editor = "vi"
engine-strict = false
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
force = false
format-package-lock = true
fund = true
git = "git"
git-tag-version = true
global = false
global-style = false
; globalconfig = "/usr/local/etc/npmrc" (overridden)
; globalignorefile = "/usr/local/etc/npmignore" (overridden)
group = 1000
ham-it-up = false
heading = "npm"
https-proxy = null
if-present = false
ignore-prepublish = false
ignore-scripts = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "/home/myname/.npm-init.js"
init-version = "1.0.0"
json = false
key = null
legacy-bundling = false
link = false
local-address = undefined
loglevel = "notice"
logs-max = 10
; long = false (overridden)
maxsockets = 50
message = "%s"
; metrics-registry = null (overridden)
node-options = null
node-version = "10.22.0"
noproxy = null
offline = false
onload-script = null
only = null
optional = true
otp = null
package-lock = true
package-lock-only = false
parseable = false
prefer-offline = false
prefer-online = false
; prefix = "/usr" (overridden)
preid = ""
production = false
progress = true
proxy = null
read-only = false
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
rollback = true
save = true
save-bundle = false
save-dev = false
save-exact = false
save-optional = false
save-prefix = "^"
save-prod = false
scope = ""
script-shell = null
scripts-prepend-node-path = "warn-only"
searchexclude = null
searchlimit = 20
searchopts = ""
searchstaleness = 900
send-metrics = false
shell = "/bin/bash"
shrinkwrap = true
sign-git-commit = false
sign-git-tag = false
sso-poll-frequency = 500
sso-type = "oauth"
strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
timing = false
tmp = "/tmp"
umask = 2
unicode = true
unsafe-perm = true
update-notifier = true
usage = false
user = 0
; user-agent = "npm/{npm-version} node/{node-version} {platform} {arch} {ci}" (overridden)
userconfig = "/home/myname/.npmrc"
version = false
versions = false
viewer = "man"

I found .npmrc in /usr/lib/node_modules/npm它是空的。

I found npmrc in /usr/local/lib/node_modules/npm及其内容:

globalconfig=/etc/npmrc
globalignorefile=/etc/npmignore
prefix=/usr/local

看了上面的内容,你有没有发现什么奇怪的地方呢?我读npm 配置 https://docs.npmjs.com/using-npm/config and npmrc https://docs.npmjs.com/files/npmrc但找不到任何有用的东西。

Thanks.


我遇到了同样的错误,我删除了 package-lock.json 文件和 node_module 文件夹,它起作用了。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

解析附近时 JSON 中位置 XXX 出现意外标记的错误 的相关文章

随机推荐

  • 内部生成器:无法运行程序“g++”:系统找不到指定的文件

    Internal Builder is used for build g ot1 o t1 cpp Internal Builder Cannot run program g The system cannot find the file
  • :: 在 AngularJS 中是什么意思

    我见过这样的语法 a href some other thing a 那个双冒号是做什么用的 如果将其删除会发生什么 用于一次性绑定 一旦稳定 即第一次消化后 表达式将停止重新计算 所以任何更新something将不可见
  • 将 csv 从云存储导入到云 sql 时服务帐户访问被拒绝(权限问题?)

    我正在尝试使用云存储中的 csv 填充 mysql 数据库 我正在使用API浏览器 https cloud google com sql docs mysql admin api v1beta4 instances import examp
  • 循环 DOMDocument

    我正在遵循这个问题 Robust 的建议 成熟的 PHP HTML 解析器 https stackoverflow com questions 292926 robust mature html parser for php 321963
  • 在 C++ 中将结构体转换为 int

    我有一个结构来表示 29 位 CAN 标识符 其位字段如下 struct canId u8 priority 3 u8 reserved 1 u8 dataPage 1 u8 pduFormat 8 u8 pduSpecific 8 u8
  • 如何使用 Azure DevOps 处理 React 应用程序中的多个环境

    开发人员在那里 我在尝试使用 Azure DevOps 在我的 React 项目中设置多个环境时遇到了一些问题 关于如何完成这项工作的信息并不多 我可以看到如何做到这一点 我想要 发展 生产 目前我已经在我的 React 应用程序上实现了它
  • CORS和XSS有什么联系吗?

    维基百科页面中提到了跨站脚本 XSS CORS http en wikipedia org wiki Cross origin resource sharing 但我不明白它们有什么关系 CORS 和 XSS 之间有什么联系 维基百科文章中
  • 如何从 Android 中的应用程序中删除共享首选项数据

    如何删除我的应用程序的 SharedPreferences 数据 我正在创建一个使用大量 Web 服务来同步数据的应用程序 出于测试目的 我需要在重新启动应用程序时清除一些 SharedPreferences 值 要删除特定值 Shared
  • 使用 Knockout foreach 绑定嵌套数组

    我需要帮助使用淘汰 foreach 绑定嵌套数组 下面是代码 想知道如何获取 PatAppointments 数组中的元素
  • 仅当传入值时才执行Where条件

    我有以下 LINQ 语句where on the date and a LabID 我正在传递实验室列表和日期 但是它们不是必需的 并且我可能只传递日期 而不传递实验室 在这种情况下 我想获取该特定实验室的所有实验室的结果 这是我现在所拥有
  • 删除位图的黑色背景颜色

    我需要在 C VS2013 中删除位图的黑色背景颜色 就像我在画布上画一些点一样 这canvas是黑色的 我只需要将画布更改为透明的同时保持其上的彩色点不做任何改变 我在以下位置得到了解决方案 如何从位图中删除白色背景色 https sta
  • 如何在 Windows 服务中使用 Threadpool.QueueUserWorkItem?

    我有一个 Windows 服务 正在使用 Threadpool QueueUserWorkItem 该服务连接到多个客户端数据库 抓取数据 转换为 XLS 并将文件发送到相应的 FTP 我对下面的代码有 3 个问题 我是否正确使用 Thre
  • 使用 FParsec 解析方法参数

    我正在尝试使用 FParsec 实现方法参数解析器 我想知道 FParsec 本身是否有一些已经实现的功能可以帮助我实现此目的 我问这个问题是因为 FParsec 在处理运算符优先级时提供了工具 所以可能也有一些东西可以解决这个问题 解析左
  • Zend GetText 和 .mo .po 文件

    我继承了一家开发公司的应用程序 我需要为我的网站生成 mo 和 po 文件 这是我在引导程序中的内容 translate new Zend Translate gettext ROOT PATH languages en default m
  • C# - Visual Studion 2022 中的多行逐字字符串不包含换行符 (\r)

    我们在定义逐字多行字符串时面临问题 some string 在 Visual Studio 2022 中 虽然我们在 Windows 机器和变量上编译代码Environment NewLine定义 r n作为新行 逐字多行字符串仅包含 n
  • 在 Airflow GUI 外部创建连接

    我想在不与 Airflow GUI 交互的情况下创建 S3 连接 是否可以通过airflow cfg或命令行 我们正在使用 AWS 角色 以下连接参数适用于我们 aws account id xxxx role arn yyyyy 因此 在
  • 适合初学者的 Slim 框架 [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 人们如何学习如何使用这个系统 我似乎找不到任何教程或书籍或任何有关如何使用该程序的内容 是的 他们的网站简要解释了一些事情 但没有任何澄清
  • 如何获取WebBrowser控件中的页面标题?

    当我导航到不同的网站时 如何获取 WebBrowser 控件中的页面标题 xmlns xmlns phone clr namespace Microsoft Phone Controls assembly Microsoft Phone 以
  • 为什么Android要求包名至少有两个标识符?

    创建新的 Android 应用程序时 Eclipse http androidcodingtips blogspot com 2011 08 package name must have at least two html抱怨Package
  • 解析附近时 JSON 中位置 XXX 出现意外标记的错误

    I npm install在一个目录上package json对于我的公司项目 然而 它不断给我带来各种错误 Unexpected token in JSON at position 我已经做好了npm cache clean force