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

running bitly-client throws message: /usr/bin/env: ‘node --harmony’: No such file or directory #5

Closed
jmpmcmanus opened this issue Dec 17, 2017 · 4 comments

Comments

@jmpmcmanus
Copy link

I'm running bitly-client on a fedora machine, and I'm using anaconda 3-4.4.0. When I attempt to run bitly-client it throws the following message:

/usr/bin/env: ‘node --harmony’: No such file or directory

It works if I change: #!/usr/bin/env node --harmony in:

/home/jmcmanus/anaconda3/lib/node_modules/bitly-client/index.js

to:

#!/home/jmcmanus/anaconda3/bin/node --harmony

This made me think that I had an older version of node somewhere on my system that env was
finding, producing the error. However, when I run the following command:

find ${PATH//:/ } -maxdepth 1 -executable | grep node

The output does not show any additional node binaries:

/home/jmcmanus/anaconda3/bin/node-gyp
/home/jmcmanus/anaconda3/bin/node
/home/jmcmanus/anaconda3/bin/node-gyp-bin
/usr/bin/cgnsnodes
/usr/sbin/vgmknodes

env | grep PATH also list /home/jmcmanus/anaconda3/bin as existing in PATH.

My current thought is that the problem is not due to bitly-client, but how I have anaconda
setup, or some other esoteric issue in how I have my system setup. However, I thought
it was important to share my experience with others.

Jim

@jmpmcmanus
Copy link
Author

As a note: Changing /usr/bin/env: node --harmony to /usr/bin/env: node also works. I found a reference to the Linux kernel not supporting multiple arguments in shebangs, so you can't pass the --harmony flag using #!/usr/bin/env node --harmony (SpencerCDixon/redux-cli#42)

@specious
Copy link
Owner

Thanks for reporting this issue, @jmpmcmanus.

I used the tj/n node version manager to test bitly-client with various versions of node and discovered that only node versions 0.12.x and earlier require the --harmony flag to run the latest version of bitly-client. Starting with node 4.0.0 all required language features are included as standard.

I added a minimum requirement of nodejs >=4.0.0 in package.json (b2aff82) and then, I think, safely removed the --harmony flag (e6f2a64, version 1.5.7).

I also configured basic build testing with multiple node versions using Travis CI (9e24b6c), which shows bitly-client launching without error on Ubuntu 14.04.5 LTS.

I think the issue should be resolved as of version 1.5.7.

To gain clarity on the issue, this Stack Overflow answer explains that:

Under Cygwin and Linux everything after the path of the shebang gets parsed to the program as one argument.

That means, on MacOS, where that doesn't appear to be a limitation, I can reproduce this behavior with:

$ env "node --harmony"
env: node --harmony: No such file or directory

Thanks for the tip!

@specious
Copy link
Owner

This answer by @JoergWMittag and subsequent comments provide the full story regarding shebangs on POSIX systems.

TL;DR:

we can’t portably use arguments in a shebang

@jmpmcmanus
Copy link
Author

jmpmcmanus commented Dec 18, 2017 via email

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

2 participants