0

我正在尝试使用 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.

这个问题表明错误可能是由ignore file但我根本没有使用.foxxignore文件引起的。知道还有什么可能导致此错误吗?

下面是我package.json的所有脚本。install:serviceupgrade:servicesetup抛出这个错误。

{
  "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"
  }
}

4

1 回答 1

0

这可能为时已晚,但我发现较新版本的joi与安装在封面下的版本 (v14) 不兼容。

这对我有用(摘自package.json):

{
    "dependencies": {
        "chai": "^4.3.4",
        "joi": "^14.3.1"
    }
}
于 2021-12-01T00:02:12.683 回答