tdegrunt / jsonschema

JSON Schema validation
Other
1.82k stars 262 forks source link

urilib.resolve is not a function at Validator2.validate #399

Open mamadfar opened 2 months ago

mamadfar commented 2 months ago

Still, the problem with URL exists "urilib.resolve is not a function at Validator2.validate"

FYI: I fixed it (again #367 ), just by installing url package.

It would be great if you can add url package as a dependency to jsonschema package.

awwright commented 2 months ago

@mamadfar What environment are you using? There should be a built-in require('url')

mamadfar commented 1 month ago

I'm not sure what do you mean by What environment but, I used it with Docker and AWS, the result was the same, so I had to install it manually.

The techs that I used:

Node: 18 | 20 React: 18

awwright commented 1 month ago

I'm sorry not sure what's going on then, my Node.js v22.4.0 has the necessary function builtin:

> require('url')
{
  Url: [Function: Url],
  parse: [Function: urlParse],
  resolve: [Function: urlResolve],
  resolveObject: [Function: urlResolveObject],
  format: [Function: urlFormat],
  URL: [class URL] {
    canParse: [Function: canParse],
    createObjectURL: [Function: createObjectURL],
    revokeObjectURL: [Function: revokeObjectURL]
  },
  URLSearchParams: [class URLSearchParams],
  domainToASCII: [Function: domainToASCII],
  domainToUnicode: [Function: domainToUnicode],
  pathToFileURL: [Function: pathToFileURL],
  fileURLToPath: [Function: fileURLToPath],
  urlToHttpOptions: [Function: urlToHttpOptions]
}
mamadfar commented 1 month ago

It should support the older version, right? Currently, many apps are working with Node >= 20. So, it would be great if we have it with the package, in that case, no one is forced to use Node 22 or install the URL package manually.

awwright commented 1 month ago

'url' has been in Node.js core since the very beginning, or very near it. I'm really not sure what's going on, without more information.

mamadfar commented 1 month ago

I'm not sure what is the problem, I used it again in a new project and I got the same error. #367 So, there is no more information I think 😅 Imagine a barebone React 18 project (TailwindCSS - Ant Design) and Node 18 or 20 FYI: I used Node 22 and still the same error and I used this package in a different laptop, pipeline and environment That's the all information 😅😅