Skip to content

fxparser 5.0.8 displays the version of the application, not its own version #735

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

Open
4 of 7 tasks
tbouffard opened this issue Mar 12, 2025 · 2 comments
Open
4 of 7 tasks
Labels
Pending Pending to be confirmed by user/author for some check/update/implementation

Comments

@tbouffard
Copy link
Contributor

  • Are you running the latest version? 5.0.8
  • Have you included sample input, output, error, and expected output?
  • Have you checked if you are using correct configuration?
  • Did you try online tool? not relevant here
  • Have you checked the docs for helpful APIs and examples? not relevant here

Description

Installing fast-xml-parser with the following package.json

{
  "name": "fxp-version",
  "version": "0.0.0",
  "dependencies": {
    "fast-xml-parser": "5.0.8"
  }
}

The fxparser version is wrong: it should be 5.0.8

$ npx fxparser --version
0.0.0

Possible root cause

This behavior has probably been introduced in 8f6e089 to fix #718

Would you like to work on this issue?

  • Yes. I can help with discussions and tests
  • No
@amitguptagwl
Copy link
Member

Sorry I didnt understand it. The code you're highlighting is expected to be installed globally to be used as CLI command.

@tbouffard
Copy link
Contributor Author

Hi, I provided the reproduction with a local installation because it makes things easier to check.
I have the same behavior using a npm script calling fxparser in the project shared in the issue description.

Installing globally is worse: I got an error like this when I run the command in a directory where there is no package.json file. If there is a package.json file, I have the same behavior as when installing fxparser locally.

toma@myPC:~/fxp/GH_issue_735$ fxparser --version
node:fs:574
  return binding.open(
                 ^
Error: ENOENT: no such file or directory, open '/home/toma/fxp/GH_issue_735/package.json'
    at Object.openSync (node:fs:574:18)
    at Object.readFileSync (node:fs:453:35)
    at file:///home/toma/.nvm/versions/node/v20.18.3/lib/node_modules/fast-xml-parser/src/cli/man.js:4:31
    at ModuleJob.run (node:internal/modules/esm/module_job:234:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:122:5) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/toma/fxp/GH_issue_735/package.json'
}

Node.js v20.18.3

In https://github.com/NaturalIntelligence/fast-xml-parser/blob/v5.0.8/src/cli/man.js#L3, the process tries to load a package.json located in the current directory of the process, which seems to be the root cause of the problem.
Previously, the package.json file of the fxp npm package was loaded.

@amitguptagwl amitguptagwl added the Pending Pending to be confirmed by user/author for some check/update/implementation label Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending Pending to be confirmed by user/author for some check/update/implementation
Projects
None yet
Development

No branches or pull requests

2 participants