π [BUG REPORT] ~ Issue with `npx lingo.dev` command is not working on Windows 11
Description:
I'm experiencing the same issue mentioned in #952. When running npx lingo.dev init in PowerShell/GitBash on Windows 11, instead of executing properly, it opens the lingo.dev script file in an editor.
Environment:
- OS: Windows 11
- Node.js: v22.17.1
- npm: 11.6.1
- lingo.dev: 0.114.0
- Terminal: PowerShell
Steps to Reproduce:
- Run
npx lingo.dev init(or any other command:npx lingo.dev) - Observe that it opens the script file instead of executing the command
Additional Context:
The command appears to be trying to execute the shell script at:
C:\Users\username\AppData\Local\npm-cache\_npx\118051d5371433ee\node_modules\.bin\lingo.dev
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../lingo.dev/bin/cli.mjs" "$@"
else
exec node "$basedir/../lingo.dev/bin/cli.mjs" "$@"
fi
This seems to be a path or execution issue specific to Windows environments. Any help resolving this would be appreciated!
can i do something to fix this problem, i think the issue is with the path
can i do something to fix this problem, i think the issue is with the path
yes you can help me.. Could you share the steps to fix this issue?
Hey @Ace12Anirudh
I have checked and found that '.CMD' is already added in the 'PATHEXT'. The issue is occurring due to some other reason, not because of this. This setting is already configured on my computer. Please refer to the relevant document below for reference.
You can run the CLI directly using Node instead of going through the broken shell wrapper:
npx node node_modules/lingo.dev/bin/cli.mjs init
or (if you want to skip npx caching issues):
npx --package=lingo.dev node node_modules/lingo.dev/bin/cli.mjs init
That will execute the main CLI script properly on Windows.
npx --package=lingo.dev node node_modules/lingo.dev/bin/cli.mjs init
I have tried all your given steps, but did not work for me.
It is showing me the following errors:
Tried 1
π 11:33:23 AM β¦\p on ο issue/query_all_package ! β¬’ v22.17.1
β npx --package=lingo.dev node node_modules/lingo.dev/bin/cli.mjs init
file:///D:/p/node_modules/lingo.dev/build/cli.mjs:746
import { glob } from "glob";
^^^^
SyntaxError: Named export 'glob' not found. The requested module 'glob' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'glob';
const { glob } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:220:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:321:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)
Node.js v22.17.1
Tried 2
π 11:32:49 AM β¦\p on ο issue/query_all_package ! β¬’ v22.17.1 β± 18s
β npx node node_modules/lingo.dev/bin/cli.mjs init
file:///D:/p/node_modules/lingo.dev/build/cli.mjs:746
import { glob } from "glob";
^^^^
SyntaxError: Named export 'glob' not found. The requested module 'glob' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'glob';
const { glob } = pkg;
at #_instantiate (node:internal/modules/esm/module_job:254:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:369:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:671:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)
Node.js v25.1.0
π 11:33:07 AM β¦\p on ο issue/query_all_package ! β¬’ v22.17.1 β± 13s
β node -v
v22.17.1
@arafat-alim-office okay now try using this in the file i attached.
same issue is coming (Opening a ..dev file .. ), it is not working for me.
I'm gonna try to look into this later this week.
The latest I should be able to look at this is November 22nd. Hopefully I'll get to if before then, but I'm pretty busy π If anyone else wants to work on it, of course feel free to, but ask to be assigned to the issue first!
To avoid confusion, please be aware that I am not a member of the Lingo.dev team!
This issue is available for anyone who wants to work on it. @The-Best-Codes mentioned looking into it by November 22nd, but if you'd like to tackle it sooner, please ask to be assigned first.
assign me this issue and i will try to fix it
@ishwarthecodddr looking forward to the PR!
Hi! I'd like to work on this issue as my first open-source contribution. Iβve reproduced the problem on Windows and I believe I can fix it. Could you please assign this issue to me?
Before I begin, I want to confirm a few details:
Is the expected fix to ensure npm generates proper Windows .cmd shims for lingo.dev?
Should I update the package.json βbinβ field or follow any specific guideline you prefer?
If you agree, Iβll start working on the fix and submit a PR.
@Aastha-0803 Somebody is already assigned to this issue, so you should not work on it unless they are unassigned or a team member says it's okay.
I checked out this issue today, and the best option I can see for Windows users right now is to use WSL! There are so many issues on Windows and I don't have time to fix them, hopefully someone else will get a PR resolving this soon π
I am gonna start working on it soon , don't worry