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

Dependency on non-existing sh.exe #248

Open
Jacob-Christian-Munch-Andersen opened this issue Nov 11, 2014 · 5 comments
Open

Dependency on non-existing sh.exe #248

Jacob-Christian-Munch-Andersen opened this issue Nov 11, 2014 · 5 comments
Labels

Comments

@Jacob-Christian-Munch-Andersen

I'm trying to run Streamline on Windows, but I have had no luck so far. _node seems to register correctly as a global command, but the contents of the corresponding _node.cmd file makes no sense:

@IF EXIST "%~dp0\/bin/sh.exe" (
  "%~dp0\/bin/sh.exe"  "%~dp0\node_modules\streamline\bin\_node" %*
) ELSE (
  /bin/sh  "%~dp0\node_modules\streamline\bin\_node" %*
)

Neither %~dp0/bin/sh.exe nor /bin/sh exist, and I don't see why anyone would assume that they did.

@bjouhier
Copy link
Member

This is strange. This code is generated by NPM when you install the module. I'm developing on mac so I'm not running into the problem but I'll take a look in my windows vm.

@bjouhier
Copy link
Member

I tried on windows: _node is not working in the windows command prompt but it is working in git bash.

My _node.cmd file is different from yours!

What are your node and npm versions? (node -v and npm -v)

@Jacob-Christian-Munch-Andersen
Copy link
Author

That was with node 0.10.17 and npm 1.3.8.

I tried updating to the latest release package node 0.10.33 and npm 1.4.28. the generated script is slightly different, but the issue is exactly the same:

@IF EXIST "%~dp0\/bin/sh.exe" (
  "%~dp0\/bin/sh.exe"  "%~dp0\node_modules\streamline\bin\_node" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  /bin/sh  "%~dp0\node_modules\streamline\bin\_node" %*
)

It seems to work as intended if I just replace the lot with:

node "%~dp0\node_modules\streamline\bin\_node" %*

So at least I can get rolling.

A quick guess about the cause is that npm automatically identify streamline\bin_node as a shell script, which, to be fair, isn't technically wrong. Solving your issues with polyglots isn't exactly ideal in the first place.

On a slightly related note, is there a documented way of using the library without command line?

Edit: Never mind about that last question, you have that covered in the API documentation.

@bjouhier
Copy link
Member

The polyglot solves #158 and #167. It allows smooth operation on linux and mac.
It also works on windows if launched from a bash shell like git bash.

But it does not work any more in windows command prompt because of the way npm generates its wrapper. I want to keep the polyglot for linux and mac so I'm going to investigate if there is a way to let npm install a custom script for windows, instead of letting it generate a broken wrapper. If someone knows a way I'm interested.

Another easy fix would be to have a different command name for windows. Something like _nodewin.

The _node command line is handy for single file scripts but I'd recommend to create a launcher if you have several _js source files.

@Jacob-Christian-Munch-Andersen
Copy link
Author

The magic happens in https://github.com/ForbesLindesay/cmd-shim, which unfortunately seems to be locked hard to launch with whatever is specified in the shebang.

@bjouhier bjouhier added the bug label Aug 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants