isaacs/npm — Issue #1900: bin files not working in Windows
Author: dfellis
Created: 2011-12-18 23:36:15+00:00
State: open

I recently wrote a command-line utility with a plugin system (which would really like the [peerDependencies](https://github.com/isaacs/npm/issues/1400) feature. ;) ).

In Linux it's working fine, but in Windows the executables throw the error: ``The system cannot find the path specified.``

I noticed npm is generating the following script to run the files in Windows:

``
:: Created by npm, please don't edit manually.
@IF EXIST "%~dp0"\"/usr/bin/node.exe" (
"%~dp0"\"/usr/bin/node.exe" "%~dp0\.\node_modules\2csv\bin\2csv.js" %*
) ELSE (
/usr/bin/node "%~dp0\.\node_modules\2csv\bin\2csv.js" %*
)
``

While the one created for NPM itself is

``
:: Created by npm, please don't edit manually.
@IF EXIST "%~dp0"\"node.exe" (
"%~dp0"\"node.exe" "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
) ELSE (
node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
)
``

Note the ``node.exe`` and plain ``node`` in place of ``/usr/bin/node``

I think there's a bug in the way executables are generated in Windows for packages in the latest NPM bundled with Node.js 0.6.6 for Windows, which includes a newer-than-release version of npm (v1.1.0-beta4 vs 1.0.106).

Should I downgrade to 1.0.106, or does that version not work in Windows at all?