ArangoDB Foxx 服务参考错误:未定义 URL
Posted
技术标签:
【中文标题】ArangoDB Foxx 服务参考错误:未定义 URL【英文标题】:ArangoDB Foxx Service ReferenceError: URL is not defined 【发布时间】:2021-12-20 10:02:23 【问题描述】:我正在尝试使用 Foxx CLI 将服务安装到 ArangoDB,但在使用 joi
作为依赖项时出现错误。完整的堆栈跟踪如下:
Server encountered errors executing a javascript file:
@ node_modules/@sideway/address/lib/domain.js:14:21
12 | tldSegmentRx: /^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,
13 | domainSegmentRx: /^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,
> 14 | URL: Url.URL || URL // $lab:coverage:ignore$
| ^
15 | ;
16 |
17 |
ArangoError 3103: failed to invoke module
File: /tmp/arangod_bepCMN/services-tmp-1-4156953835/node_modules/@sideway/address/lib/domain.js
Reason: ReferenceError: URL is not defined
at Object.<anonymous> (/tmp/arangod_bepCMN/services-tmp-1-4156953835/node_modules/@sideway/address/lib/domain.js:14:21)
at Module._compile (/usr/share/arangodb3/js/common/bootstrap/modules.js:606:8)
at Object.Module._extensions..js (/usr/share/arangodb3/js/common/bootstrap/modules.js:624:12)
at Module.load (/usr/share/arangodb3/js/common/bootstrap/modules.js:551:36)
at Function.Module._load (/usr/share/arangodb3/js/common/bootstrap/modules.js:496:16)
at require (/usr/share/arangodb3/js/common/bootstrap/modules.js:98:21)
at Object.<anonymous> (/tmp/arangod_bepCMN/services-tmp-1-4156953835/node_modules/joi/lib/types/string.js:4:16)
at Module._compile (/usr/share/arangodb3/js/common/bootstrap/modules.js:606:8)
at Object.Module._extensions..js (/usr/share/arangodb3/js/common/bootstrap/modules.js:624:12)
at Module.load (/usr/share/arangodb3/js/common/bootstrap/modules.js:551:36)
For details check the arangod server logs.
这个issue 指出错误可能是由ignore file
引起的,但我没有使用
.foxxignore
文件。知道还有什么可能导致此错误吗?
下面是我的package.json
和所有脚本。 install:service
、upgrade:service
和 setup
都会抛出这个错误。
"name": "auth",
"version": "0.0.0",
"description": "",
"main": "dist/entry.js",
"scripts":
"build": "tsc -p .",
"install:service": "npm run build && foxx install /auth --server dev --database party",
"upgrade:service": "npm run build && foxx upgrade /auth --server dev --database party",
"setup": "foxx server set dev http://root:password@localhost:8529 --database party && npm run install:service"
,
"keywords": [],
"author": "",
"license": "ISC",
"dependencies":
"joi": "^17.4.2"
,
"devDependencies":
"@types/arangodb": "^3.5.13",
"@types/joi": "^17.2.3",
"@types/node": "^16.11.6",
"tslint": "^6.1.3",
"typescript": "^4.4.4"
【问题讨论】:
【参考方案1】:这可能晚了,但我发现 joi 的较新版本与安装在封面下的版本 (v14) 不兼容。
这对我有用(摘自package.json
):
"dependencies":
"chai": "^4.3.4",
"joi": "^14.3.1"
【讨论】:
以上是关于ArangoDB Foxx 服务参考错误:未定义 URL的主要内容,如果未能解决你的问题,请参考以下文章
融合RocksDB, Pregel, Foxx & Satellite Collections 怎样使数据库性能提升35%?
融合RocksDB, Pregel, Fault-Tolerent Foxx & Satellite Collections 怎样使数据库性能提升35%?