Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "path" argument must be of type string. Received undefined introduced in v1.14.4 #131

Open
codeflorist opened this issue Nov 14, 2024 · 4 comments

Comments

@codeflorist
Copy link

I'm using json-autotranslate with this call:

npx json-autotranslate --source-language en --directory-structure ngx-translate  --type key-based  --decode-escapes --delete-unused-strings --service deepl-free --config <TOKEN>

Using a en.json like this:

{
	"test": "example"
}

This was working fine using v1.14.3.

But with v1.14.4 the following error is thrown:

An error has occurred:
The "path" argument must be of type string. Received undefined
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at Object.join (node:path:433:7)
    at DeepL.runTranslation (C:\Users\<USER>\AppData\Local\npm-cache\_npx\c2e5601f47c93b16\node_modules\json-autotranslate\lib\services\deepl.js:230:39)
    at DeepL.translateStrings (C:\Users\<USER>\AppData\Local\npm-cache\_npx\c2e5601f47c93b16\node_modules\json-autotranslate\lib\services\deepl.js:123:43)
    at C:\Users\<USER>\AppData\Local\npm-cache\_npx\c2e5601f47c93b16\node_modules\json-autotranslate\lib\index.js:243:60
    at translate (C:\Users\<USER>\AppData\Local\npm-cache\_npx\c2e5601f47c93b16\node_modules\json-autotranslate\lib\index.js:184:72)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Using npx with the specifix v1.14.3 version (npx [email protected] ...) is a temporary solution.

@monsieur-ricky
Copy link
Contributor

Any news on this issue? What is the root cause?

@monsieur-ricky
Copy link
Contributor

monsieur-ricky commented Dec 3, 2024

Well, after giving a closer look into the latest release, I saw this change in the README: set the glossaries folder to be used by DeepL. Keep empty for automatic determination of matching glossary.
So, adding -g to the command makes everything work again.

@leolabs maybe make it more clear in the docs that this option is mandatory? 🤔

@leolabs
Copy link
Owner

leolabs commented Dec 27, 2024

Hey @monsieur-ricky, please excuse my late reply!

I've just released a new version that should fix this issue. You shouldn't have to include the -g option if you're not working with glossaries.

Could you check if this 1.14.5 works for you?

@monsieur-ricky
Copy link
Contributor

Hey @leolabs, no problem. Did a quick test and everything seems to be working correctly. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants