Closed johnwebbcole closed 9 years ago
And npm install will set the correct location for you.
If I set the shebang to #!/usr/bin/env node
, npm will set the correct location of what for me? If it's just node, that's not good enough because some platforms have env at /bin instead of /usr/bin, so that's not a magic bullet.
PS: switching to #!/usr/bin/env node
is likely better than /usr/local/bin/node, but even env node
is going to fail in some brain damaged Linux distros where node is nodejs
instead of node
. If npm does something smart about rewriting shebang, then taking advantage of that is the best course.
On ubuntu and OS X, node isn't at #!/usr/bin/env node
, but it still works when installed. I'm trying to find where it's mentioned that npm wants the line to be #!/usr/bin/env node
, but I'm having trouble finding it again.
Here's the SO where it's mentioned: http://stackoverflow.com/questions/10396305/npm-package-bin-script-for-windows
On ubuntu and OS X, node isn't at #!/usr/bin/env node, but it still works when installed
That's expected, because on both of those platforms, env
is at /usr/bin/env.
Because npm does try to be intelligent about the shebang when it's set to env, I've made the change.
When installing on ubuntu, the shebang line is not pointing to the correct location. I think the line should be
#!/usr/bin/env node
And npm install will set the correct location for you.