andrewbober / xsd2jsonschema

A pure JavaScript library for translating complex XML Schemas into JSON Schemas.
https://www.xsd2jsonschema.org
Apache License 2.0
48 stars 25 forks source link

Uncaught TypeError: path.parse is not a function #27

Closed mzrt closed 3 years ago

mzrt commented 3 years ago

Nodejs version: 10.16.3 npm version: 6.4.1

When I run the example from the readme, I get an error:

Uncaught TypeError: path.parse is not a function at new JsonSchemaFile (jsonSchemaFile.js:233) at new JsonSchemaFileDraft04 (jsonSchemaFileDraft04.js:23) at new JsonSchemaFileDraft06 (jsonSchemaFileDraft06.js:23) at new JsonSchemaFileDraft07 (jsonSchemaFileDraft07.js:21) at NamespaceManager.newJsonSchema (namespaceManager.js:133) at NamespaceManager.addNewJsonSchema (namespaceManager.js:141) at Xsd2JsonSchema. (xsd2JsonSchema.js:275) at Array.forEach () at Xsd2JsonSchema.processSchemas (xsd2JsonSchema.js:272) at Xsd2JsonSchema.processAllSchemas (xsd2JsonSchema.js:303) at onClick (App.tsx:418) at HTMLUnknownElement.callCallback (react-dom.development.js:188) at Object.invokeGuardedCallbackDev (react-dom.development.js:237) at invokeGuardedCallback (react-dom.development.js:292) at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:306) at executeDispatch (react-dom.development.js:389) at executeDispatchesInOrder (react-dom.development.js:414) at executeDispatchesAndRelease (react-dom.development.js:3278) at executeDispatchesAndReleaseTopLevel (react-dom.development.js:3287) at forEachAccumulated (react-dom.development.js:3259) at runEventsInBatch (react-dom.development.js:3304) at runExtractedPluginEventsInBatch (react-dom.development.js:3514) at handleTopLevel (react-dom.development.js:3558) at batchedEventUpdates$1 (react-dom.development.js:21871) at batchedEventUpdates (react-dom.development.js:795) at dispatchEventForLegacyPluginEventSystem (react-dom.development.js:3568) at attemptToDispatchEvent (react-dom.development.js:4267) at dispatchEvent (react-dom.development.js:4189) at unstable_runWithPriority (scheduler.development.js:653) at runWithPriority$1 (react-dom.development.js:11039) at discreteUpdates$1 (react-dom.development.js:21887) at discreteUpdates (react-dom.development.js:806) at dispatchDiscreteEvent (react-dom.development.js:4168)

andrewbober commented 3 years ago

mzrt - It looks like you're running within a React application. Please ensure you're bringing in a version of the Path class that is compatible with Path from NodeJS, which is documented here https://nodejs.org/docs/latest-v10.x/api/path.html.

andrewbober commented 3 years ago

Let me know if you need anything else on this. Thanks for the question.