You are not logged in.

#1 2013-08-18 23:54:10

wrb302
Member
Registered: 2013-08-18
Posts: 3

[Solved] /usr/bin/env node --harmony: no such file or directory

Hi,

I have a script look like this:

test.sh:

#!/usr/bin/env node --harmony
console.log("hello")

When I run the script, it says "/usr/bin/env node --harmony: no such file or directory".

If I remove the "--harmony" on the first line, then it works.

What am I missing something?

Thanks!

Last edited by wrb302 (2013-08-19 01:29:05)

Offline

#2 2013-08-19 00:26:15

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,444
Website

Re: [Solved] /usr/bin/env node --harmony: no such file or directory

I don't think you can pass command line arguments through env like that.  Just remove env and call node directly and it works:

#!/usr/bin/node --harmony
...

edit:

If you really need to use env to allow for node to be located somewhere else in the path, well then you still don't really need to use env:

#!/bin/sh
exec node --harmony <<EOF
console.log("hello")
EOF

Last edited by Trilby (2013-08-19 00:32:25)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2013-08-19 00:54:59

wrb302
Member
Registered: 2013-08-18
Posts: 3

Re: [Solved] /usr/bin/env node --harmony: no such file or directory

Hi Trilby,

Thanks for your quick response. Actually this is a script  in a node module I am trying to install: https://github.com/Sage/streamlinejs/bl … /bin/_node

This script actually works on Mac without problem.

Also, from man env it looks like it accepts arguments for command:

NAME
       env - run a program in a modified environment

SYNOPSIS
       env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]

And I just tried running "/usr/bin/env node --harmony" in the console directly, it also works.

So I guess this is a quirk of Arch linux?

Offline

#4 2013-08-19 01:06:17

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [Solved] /usr/bin/env node --harmony: no such file or directory

The Linux kernel does not support multiple arguments in shebangs. This has nothing to do with Arch specifically.

Offline

#5 2013-08-19 01:27:22

wrb302
Member
Registered: 2013-08-18
Posts: 3

Re: [Solved] /usr/bin/env node --harmony: no such file or directory

Looks like this is a defect in that script.

Thanks falconindy!

Offline

Board footer

Powered by FluxBB