Skip to content
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

winpty: error: cannot start 'mvn': Not found in PATH #138

Open
mihab opened this issue Feb 19, 2018 · 7 comments
Open

winpty: error: cannot start 'mvn': Not found in PATH #138

mihab opened this issue Feb 19, 2018 · 7 comments

Comments

@mihab
Copy link

mihab commented Feb 19, 2018

A bit silly, but does anyone know what is going on here:

miha@DESKTOP-CEC4TIT MINGW64 ~
$ mvn --version
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T09:58:13+02:00)
Maven home: C:\Users\miha\Dev\maven\3.5.2
Java version: 1.8.0_161, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_161\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

miha@DESKTOP-CEC4TIT MINGW64 ~
$ winpty mvn --version
winpty: error: cannot start 'mvn': Not found in PATH

miha@DESKTOP-CEC4TIT MINGW64 ~
$ winpty which mvn
/c/Users/miha/Dev/maven/3.5.2/bin/mvn

Quite obviously mvn is on the path, works with Command Prompt and Git Bash (but cannot be interrupted), but when used via winpty it's apparently not on the path? Does winpty use a different path variable or something?

@k-takata
Copy link

How about executing with the .cmd extension?
$ winpty mvn.cmd

@mihab
Copy link
Author

mihab commented Feb 20, 2018

Yes it does work, thanks! Can someone explain why mvn.cmd works but mvn and mvn.exe don't?

@wulph111
Copy link

wulph111 commented Mar 10, 2018

Under cygwin, the same behavior occurs with node.js components npm and npx.
Also node packages such as serialport with standalone commands:

$ which serialport-list
/cygdrive/c/Users/admin/AppData/Roaming/npm/serialport-list

$ ls /cygdrive/c/Users/admin/AppData/Roaming/npm
create-react-app      ng            nodemon       node-red-pi.cmd          serialport-list      serialport-term.cmd
create-react-app.cmd  ng.cmd        nodemon.cmd   npm-windows-upgrade      serialport-list.cmd  yo
electron              node_modules  node-red      npm-windows-upgrade.cmd  serialport-repl      yo.cmd
electron.cmd          node-gyp      node-red.cmd  reddit-oauth-helper      serialport-repl.cmd  yo-complete
etc                   node-gyp.cmd  node-red-pi   reddit-oauth-helper.cmd  serialport-term      yo-complete.cmd

$ serialport-list
COM1    ACPI\PNP0501\1  (Standard port types)

$ winpty serialport-list
winpty: error: cannot start 'serialport-list': Not found in PATH
code 1

$ winpty serialport-list.cmd
COM1    ACPI\PNP0501\1  (Standard port types)

@mihab Yes it does work, thanks! Can someone explain why mvn.cmd works but mvn and mvn.exe don't?

There's probably no mvn.exe in your PATH directories, and winpty explicitly appends .exe to the program name when searching:

                if (endsWith(candidate, ".bat") || endsWith(candidate, ".cmd")) {
#ifdef __MSYS__
                    // In MSYS/MSYS2, batch files don't have the execute bit
                    // set, so just check that they're readable.
                    perm = R_OK;
#endif
                } else if (endsWith(candidate, ".com") || endsWith(candidate, ".exe")) {
                    // Do nothing.
                } else {
                    // Make the exe extension explicit so that we don't try to
                    // run shell scripts with CreateProcess/winpty_spawn.
                    candidate += ".exe";
                }

@mihab
Copy link
Author

mihab commented Mar 13, 2018

I see, thanks for the explanation. It's still kinda weird behaviour and perhaps not so intuitive, what do you think should be done about this ticket @wulph111 ? Close as a non-bug?

@wulph111
Copy link

I'd leave it open for @rprichard to decide.. it's confusing behavior but maybe necessary. I don't know enough to say if it can be "fixed" -- I'm only here because I had the same problem :)

@ModeEngage
Copy link

Shouldn't winpty respect the PATH_EXT environment variable?

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY

@sakshiahuja
Copy link

Screenshot (89)
What's this? After managing aliases permission denied got resolved but now this ?
winpty : Not found in PATH ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants