mololab / json-translator

jsontt 💡 - AI JSON Translator with GPT + other FREE translation modules to translate your json/yaml files into other languages ✅ Check Readme ✌ Supports GPT / DeepL / Google / Bing / Libre / Argos
https://mololab.org/jsontt/npm
MIT License
494 stars 71 forks source link

App not working when built from sources #36

Closed Myshkouski closed 1 year ago

Myshkouski commented 1 year ago

I'm try to launch the app from sources. When running:

./bin/jsontt some-file.json

... app fails with the following error:

/home/dev/json-translator/dist/json-translator.cjs.development.js:1589
  if (global.source === exports.Sources.LibreTranslate) {
                                        ^

TypeError: Cannot read properties of undefined (reading 'LibreTranslate')
    at getLanguages (/home/dev/json-translator/dist/json-translator.cjs.development.js:1589:41)
    at getFromChoices (/home/dev/json-translator/dist/json-translator.cjs.development.js:1293:34)
    at getLanguageChoices (/home/dev/json-translator/dist/json-translator.cjs.development.js:1283:22)
    at Object.<anonymous> (/home/dev/json-translator/dist/json-translator.cjs.development.js:1218:40)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at Module.require (node:internal/modules/cjs/loader:1100:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/home/dev/json-translator/dist/index.js:7:20)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at Module.require (node:internal/modules/cjs/loader:1100:19)

Node.js v18.17.1
Myshkouski commented 1 year ago
// src/utils/prompt.ts

// seems there is no need to initialize this variables in root closure:
const { from_choices, to_choices } = getLanguageChoices();
ParvinEyvazov commented 1 year ago

fixed in https://github.com/mololab/json-translator/pull/37

thanks @Myshkouski 💛