Bug 38031 - po2json not found
Summary: po2json not found
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 37303
Blocks:
  Show dependency treegraph
 
Reported: 2024-09-30 10:05 UTC by Jonathan Druart
Modified: 2024-10-07 08:15 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 38031: Make po2json available to yarn (995 bytes, patch)
2024-09-30 10:06 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 38031: Make po2json available to yarn (1.03 KB, patch)
2024-09-30 10:27 UTC, Paul Derscheid
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2024-09-30 10:05:42 UTC
If you run `yarn run po2json` from /kohadevbox/koha and no local node_modules directory exists, you will get:

  error Command "po2json" not found.

See the different outputs:

root@kohadevbox:koha$ pwd             
/kohadevbox/koha   
root@kohadevbox:koha$ yarn run --env      
yarn run v1.22.22
error There are no binary scripts available.

root@kohadevbox:kohadevbox$ pwd
/kohadevbox
root@kohadevbox:kohadevbox$ yarn run --env
yarn run v1.22.22
info Commands available from binary scripts: JSONStream, acorn, ansi-html, atob, autoprefixer, boast, browser-pack, browserify, browserslist, browserslist-lint, color-support, cssesc, cypress, deps-sort, detective, envinfo, eslint-config-prettier, esparse, esvalidate, extract-zip, findup, gulp, handlebars, he, highlight, html-minifier-terser, import-local-fixture, insert-module-globals, is-ci, is-docker, is-inside-container, js-yaml, jsesc, json5, loose-envify, marked, miller-rabin, mime, mkdirp, module-deps, multicast-dns, nanoid, node-which, oas-validate, openapi, opener, parser, po2json, prettier, redocly, regjsparser, resolve, rimraf, rspack, rtlcss, sass, semver, sha.js, sshpk-conv, sshpk-sign, sshpk-verify, stylelint, svgo, swagger-cli, swagger2openapi, terser, tsc, tsserver, uglifyjs, umd, undeclared-identifiers, uuid, vue-cli-service, vue-demi-fix, vue-demi-switch, watchify, webpack, webpack-bundle-analyzer, webpack-cli, webpack-dev-server

I didn't find a cause of a possible regression.
Comment 1 Jonathan Druart 2024-09-30 10:06:44 UTC
Created attachment 172217 [details] [review]
Bug 38031: Make po2json available to yarn

If you run `yarn run po2json` from /kohadevbox/koha and no local node_modules directory exists, you will get:

  error Command "po2json" not found.

I didn't find a cause of a possible regression.

Having it listed in package.json fixes the problem.
Comment 2 Paul Derscheid 2024-09-30 10:27:55 UTC
Created attachment 172220 [details] [review]
Bug 38031: Make po2json available to yarn

If you run `yarn run po2json` from /kohadevbox/koha and no local node_modules directory exists, you will get:

  error Command "po2json" not found.

I didn't find a cause of a possible regression.

Having it listed in package.json fixes the problem.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 3 Jonathan Druart 2024-10-01 08:34:25 UTC
root@kohadevbox:koha$ sudo koha-translate --update fr-FR --dev kohadev
/bin/sh: 1: po2json: not found
error Command failed with exit code 127.                                                                                                                                                                            
read_file '/tmp/fr-FR-messages.po' - open: No such file or directory at /kohadevbox/koha/misc/translator/LangInstaller.pm line 461.


root@kohadevbox:koha$ koha-translate --update fr-FR --dev kohadev
(node:25950) [DEP0128] DeprecationWarning: Invalid 'main' field in '/kohadevbox/node_modules/po2json/package.json' of './lib/po2json'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)

(Ignore the warning for now)

It does not work with sudo.
Comment 4 Julian Maurice 2024-10-04 09:37:23 UTC
If I apply the patch, remove node_modules and run `yarn run po2json` I get:

yarn run v1.22.20
$ po2json
/bin/sh: 1: po2json: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Do you have po2json installed globally ?
Comment 5 Jonathan Druart 2024-10-04 10:13:50 UTC
In ktd we have node_modules in /kohadevbox, embedded in the image.
Comment 6 Tomás Cohen Arazi (tcohen) 2024-10-04 12:19:52 UTC
The right way to install with yarn inside KTD is by running:

```shell
sudo yarn install --modules-folder /kohadevbox/node_modules
sudo chown -R kohadev-koha:kohadev-koha /kohadevbox/node_modules
```

After doing it, if I run the proposed command I get:

```shell
kohadev-koha@kohadevbox:koha(qa_38031)$ yarn run po2json
yarn run v1.22.22
$ po2json

input argument is required

Usage: po2json <input> <output> [options]
```

is that enough for QA? I don't have full context for this feature.
Comment 7 Jonathan Druart 2024-10-07 08:15:50 UTC
(In reply to Tomás Cohen Arazi (tcohen) from comment #6)
> The right way to install with yarn inside KTD is by running:
> 
> ```shell
> sudo yarn install --modules-folder /kohadevbox/node_modules
> sudo chown -R kohadev-koha:kohadev-koha /kohadevbox/node_modules
> ```
> 
> After doing it, if I run the proposed command I get:
> 
> ```shell
> kohadev-koha@kohadevbox:koha(qa_38031)$ yarn run po2json
> yarn run v1.22.22
> $ po2json
> 
> input argument is required
> 
> Usage: po2json <input> <output> [options]
> ```
> 
> is that enough for QA? I don't have full context for this feature.

You don't need to install actually, but yes, it's is what it fixed. Without this patch `yarn run po2json` results in "command not found".