Skip to content

Problem with git pre-push (ts-node) when it's powershell & ts-node.cmd #23154

Open

Agent suggestions

Public preview

Description

@b5414

The problem

Unable to push my commits when using powershell & ts-node package installed, PATHEXT=.CPL and cmd ts-node not found the "ts-node.cmd"

Release version

Version 3.6.11-beta1 (x64)

Operating system

win 10

Steps to reproduce the behavior

  1. On Windows, open GitHub Desktop 3.6.11-beta1
  2. Configure Git hooks to use Windows PowerShell
  3. Setup pre-push hook with:
#!/bin/sh

npm run abc

status=$?

exit $status
  1. Create package.json with scripts.abc: "ts-node ./testfile.ts" & devDep: "ts-node"
  2. npm i
  3. Try to push

Log files

Running pre-push hook...

> [email protected] abc
> ts-node ./test/abc.ts

"ts-node" �� ���� ����७��� ��� ���譥�

��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.

pre-push hook failed with code 1 after 2.35s

Screenshots

No response

Additional context

You unable to copy the error text in a dark box - error message modal win (white theme) 😡

Also, can you guys fix this indecoded "���"?

Activity

  1. desktop-triage commented on Nov 10, 2026

    @desktop-triage

    Classification: Bug (partially), with a mixed/multi-issue report

    This report bundles two technically different symptoms: (1) a pre-push npm run script invoking ts-node failing to resolve ts-node.cmd when PowerShell is configured as the hooks shell with a custom PATHEXT=.CPL, and (2) garbled (mojibake) non-ASCII hook output in the failure dialog. I'm suggesting bug for the encoding symptom, which is reproducible and plausibly a product issue, and more-info-needed because the PATHEXT/ts-node.cmd resolution failure needs more detail to confirm it's a Desktop bug versus an environment-specific PATHEXT misconfiguration, and because the "can't copy error text" complaint overlaps with other already-tracked issues and should be separated out.

    Initial hypothesis: The raw hook stderr bytes are captured without any codepage/encoding conversion and then handed straight to an xterm.js Terminal instance for rendering, which assumes UTF-8 input; on Windows, child processes spawned via cmd/PowerShell typically emit console output in the system's OEM codepage (e.g. CP866 for Russian locales), not UTF-8, so bytes like those in the report ("ts-node" ‐‐ ... shown as �) would render as mojibake rather than being transcoded. In createHooksProxy, hook stderr chunks are collected into a Buffer[] and passed through to the UI as TerminalOutput (app/src/lib/hooks/hooks-proxy.ts), and the Terminal component writes those buffers directly to xterm without any encoding conversion step (

    public write(data: TerminalOutput) {
    if (Array.isArray(data)) {
    data.forEach(chunk => this.terminal?.write(chunk))
    } else {
    this.terminal?.write(data)
    }
    }
    ). This is consistent with the user's screenshot-free log excerpt showing corrupted Cyrillic text instead of readable error output. The separate "ts-node.cmd" / PATHEXT=.CPL resolution failure would need additional detail (exact PATHEXT value used, Node/npm version, and whether reproducible with default PATHEXT) to determine whether it's a genuine Desktop/hook-shell issue or an artifact of the user's customized PATHEXT.

    Duplicate Check: No exact duplicate found. #22591 and #21785 (closed) cover inability to copy text from hook-failure/commit-failed modals on Windows — related to, but distinct from, this issue's encoding corruption and the separate ts-node/PATHEXT resolution problem; they don't address character encoding or PATHEXT. No existing issue specifically covers OEM-codepage mojibake in hook output or PATHEXT-based script resolution.

    Suggested Next Steps: Ask the reporter to confirm (a) whether the ts-node resolution failure reproduces with default PATHEXT (i.e., is .CPL-only PATHEXT intentional or a system misconfiguration), and (b) their Windows display language/locale, to help confirm the OEM-codepage hypothesis for the garbled text. Consider filing the "can't copy text" complaint separately, referencing #22591.

    Generated by Issue Triage (skills-driven) for #23154 · auto · 130.9 AIC · ⊞ 4.7K · ◷

  2. added
    more-info-needed
    on Nov 17, 2026
  3. babakks commented on Nov 17, 2026

    @babakks
    Member

    Thanks for reporting this, @b5414! 🙏

    Command resolution and PATHEXT

    PATHEXT normally includes several executable extensions, including .CMD, which allows commands such as ts-node to resolve to ts-node.cmd. If its complete value is just .CPL, that could explain the failure.

    Could you share the full PATHEXT value both inside the failing hook and in a normal PowerShell session? Does the same hook work when you push from PowerShell outside GitHub Desktop? This would help us determine whether Desktop is loading the environment incorrectly.

    Garbled error output

    The unreadable characters appear related to #16892, which tracks Windows hook output being displayed incorrectly when it uses a non-UTF encoding. We can track that symptom separately from the command-resolution failure.

    Could you also share your Windows system locale and PowerShell version to help us compare the reports?

  4. b5414 commented on Nov 23, 2026

    @b5414
    Author

    @babakks I just reproduced the push failure with GitHub Desktop 3.6.12-beta2

    The pre-push hook exited with code 1 when an npm script tried to run ts-node

    In my earlier reproduction of the hook environment on 3.6.11-beta1, with Windows PowerShell selected as the hook shell, the full PATHEXT value was .CPL
    The latest Desktop log does not include PATHEXT

    In a regular Windows PowerShell session, the full value is:

    .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
    

    I confirmed that PowerShell can resolve the local ts-node.cmd when node_modules\.bin is on PATH
    A full push from PowerShell is still unverified

    The commit completed successfully in GitHub Desktop
    The failure reproduced on two subsequent push attempts, both when the pre-push hook tried to run ts-node

    btw my win locale is ru-RU (ANSI code page 1251, OEM code page 866), and my PowerShell version: 5.1.19041.7725

  5. removed
    more-info-needed
    on Nov 23, 2026
  6. Taiizor commented on Nov 27, 2026

    @Taiizor

    I traced the PATHEXT=.CPL value reported here to the way Desktop loads the hook environment, and I opened #23245 with the details.

    In short, getShellEnv (app/src/lib/hooks/get-shell-env.ts) spawns the shell with env: {}, so PATHEXT is missing. PowerShell then sets it to just .CPL, and the hook inherits that value, which is why .cmd shims like ts-node.cmd can't be resolved. Choosing Git Bash or Command Prompt as the hook shell works around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions