npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

cygpath not found on windows with MINGW shell

What I Wanted to Do

eslint cannot run from bash shell on Windows because cygpath is not found.

What Happened Instead

sh.exe"-3.1$ ./node_modules/.bin/eslint --version
./node_modules/.bin/eslint: line 5: cygpath: command not found
    throw err;

Error: Cannot find module 'd:\eslint\bin\eslint.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

Reproduction Steps

See above


Anyway, commenting the following lines in ./node_modules/.bin/eslint makes eslint works without problems:

case `uname` in
    *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;

I reinstalled MINGW and MSYS just to see if cygpath is installed with some package, but was unable to find it (also the package cygutil does not provide cygpath). I suggest to change the case to detect only *CYGWIN* or remove it altogether.

The workaround is to change in my scripts ./node_modules/.bin/eslint to node ./node_modules/eslint/bin/eslint.js

Platform Info

Tell us about your environment

$ npm --versions
<!-- paste output here -->
$ node -p process.platform
<!-- paste output here -->

Same problem with ncu installed globally.

cygpath is not needed in MinGW and MSYS because these systems magically convert paths in the right way.

So please fix this. I cannot use anymore any npm installed program after the last upgrade.