ttag-org / ttag

:orange_book: simple approach for javascript localization
https://ttag.js.org/
MIT License
345 stars 43 forks source link

ttag command not found + po2json EACCES error #157

Closed glecetre closed 5 years ago

glecetre commented 5 years ago

Hello,

I am setting ttag up for my CRA + TypeScript project but I have two problems.

First, the command is not found after installing. I have to enter the full path to the binary in the node_module folder.

Second, the po2json command, when run with npm run, throws an EACCES error: "permission denied, write". But I have no permission problem when running it with node_modules/ttag-cli/bin/ttag po2json ./i18n/fr.po > ./i18n/fr.po.json. My npm script command is: "gen:po2json": "ttag po2json ./src/i18n/fr.po > ./src/i18n/fr.po.json".

I am using "ttag": "^1.7.5" (dependency) and "ttag-cli": "^1.7.5" (devDependency) on Linux Mint 19, with a Fish shell.

Thanks :)

AlexMost commented 5 years ago

Hi @glecetre!

First, the command is not found after installing. I have to enter the full path to the binary in the node_module folder.

If you are doing install via npm i ttag-cli it will not automatically add ttag to your PATH, because this is how npm works. You have 3 options:

  1. Call ttag from the packages.json scripts.
  2. Use npx ttag.
  3. Install it globally npm i -g ttag-cli - this one will make ttag available globally but can require sudo. (depends on how nodejs and npm was installed).

Second, the po2json command, when run with npm run, throws an EACCES error: "permission denied, write".

Not sure about how to reproduce that case. Maybe that problem was caused by some non trivial installation. Can you try to install example app from here - https://github.com/ttag-org/CRA-runtime-example, go to ./app, execute npm i and run npm run po2json will it work for you?