lingo.dev icon indicating copy to clipboard operation
lingo.dev copied to clipboard

🐞 [BUG REPORT] ~ Issue with `npx lingo.dev` command is not working on Windows 11

Open arafat-alim-office opened this issue 3 months ago β€’ 17 comments

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:

  1. Run npx lingo.dev init (or any other command: npx lingo.dev)
  2. 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!


arafat-alim-office avatar Nov 03 '25 07:11 arafat-alim-office

can i do something to fix this problem, i think the issue is with the path

Ace12Anirudh avatar Nov 03 '25 12:11 Ace12Anirudh

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?

arafat-alim-office avatar Nov 03 '25 13:11 arafat-alim-office

yes follow the word file i created .

Problem.docx

Ace12Anirudh avatar Nov 03 '25 13:11 Ace12Anirudh

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.

Image Image

arafat-alim-office avatar Nov 03 '25 13:11 arafat-alim-office

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.

namanguptagit avatar Nov 03 '25 16:11 namanguptagit

@arafat-alim-office okay now try using this in the file i attached.

Problem.docx

Ace12Anirudh avatar Nov 03 '25 17:11 Ace12Anirudh

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 avatar Nov 04 '25 05:11 arafat-alim-office

@arafat-alim-office okay now try using this in the file i attached.

Problem.docx

same issue is coming (Opening a ..dev file .. ), it is not working for me.

arafat-alim-office avatar Nov 04 '25 05:11 arafat-alim-office

I'm gonna try to look into this later this week.

The-Best-Codes avatar Nov 04 '25 14:11 The-Best-Codes

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!

The-Best-Codes avatar Nov 08 '25 23:11 The-Best-Codes

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.

maxprilutskiy avatar Nov 10 '25 07:11 maxprilutskiy

assign me this issue and i will try to fix it

ishwarthecodddr avatar Nov 11 '25 18:11 ishwarthecodddr

@ishwarthecodddr looking forward to the PR!

sumitsaurabh927 avatar Nov 12 '25 08:11 sumitsaurabh927

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 avatar Nov 14 '25 21:11 Aastha-0803

@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.

The-Best-Codes avatar Nov 14 '25 22:11 The-Best-Codes

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 πŸ‘€

The-Best-Codes avatar Nov 22 '25 22:11 The-Best-Codes

I am gonna start working on it soon , don't worry

ishwarthecodddr avatar Nov 23 '25 04:11 ishwarthecodddr