loclapp / locl

Internationalization (i18n) tools suite for Angular
https://www.locl.app
GNU Affero General Public License v3.0
91 stars 16 forks source link

"locl convert" Not working when run as a yarn or npm script #9

Closed drewwiens closed 4 years ago

drewwiens commented 4 years ago

Many thanks for the help today with loadTranslations!

Using npx to call "locl convert" is working for me, but calling locl via a script with yarn or npm doesn't seem to work:

OS: Ubuntu 18.04.3 x64 Node: v12.15.0 (nvm) @locl/cli 0.0.1-beta.4

npx:

$ npx locl convert -s=messages.xlf -f=json -o=messages.json
Converting files from source "messages.xlf" to format "json" and output "messages.json"

package.json:

{
...
  "scripts": {
    "locl": "locl",
    ...
  },

yarn:

$yarn locl convert -s=messages.xlf -f=json -o=messages.json
yarn run v1.22.0
$ locl convert -s=messages.xlf -f=json -o=messages.json
/usr/bin/env: ‘node\r’: No such file or directory
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Command failed: /home/andrew/.yvm/versions/v1.22.0/bin/yarn.js locl convert -s=messages.xlf -f=json -o=messages.json

npm:

$ npm run locl -- convert -s=messages.xlf -f=json -o=messages.json

> i18n-ng9rc12@0.0.0 locl /home/andrew/repos/spikes/i18n-ng9-locl
> locl "convert" "-s=messages.xlf" "-f=json" "-o=messages.json"

/usr/bin/env: ‘node\r’: No such file or directory
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! i18n-ng9rc12@0.0.0 locl: `locl "convert" "-s=messages.xlf" "-f=json" "-o=messages.json"`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the i18n-ng9rc12@0.0.0 locl script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/andrew/.npm/_logs/2020-02-06T22_16_05_434Z-debug.log
ocombe commented 4 years ago

Ok so the issue was that I was building the files on windows before publishing them, and ng-packagr generates files with CRLF for file endings in this case... I'm now converting files to linux ending (LF) before publishing. It should be fixed in the latest beta.