Skip to content

Can't run as a binary #44

@jccr

Description

@jccr

I'm trying to use this in the webpub-viewer project to replace the in-tree copy.
I added r2-streamer-js as a devDependency and thought I could use it as a binary in one of my project's scripts.

It is not working unfortunately.

> webpub-viewer@0.1.0 streamed ./webpub-viewer
> r2-streamer-js-server ./examples/streamed/epubs/

./webpub-viewer/node_modules/.bin/r2-streamer-js-server: line 1: use strict: command not found
./webpub-viewer/node_modules/.bin/r2-streamer-js-server: line 2: syntax error near unexpected token `exports,'
./webpub-viewer/node_modules/.bin/r2-streamer-js-server: line 2: `Object.defineProperty(exports, "__esModule", { value: true });'

I believe you need to prepend the declared "bin" script with a node "shebang".
Example: https://github.com/isaacs/rimraf/blob/master/bin.js (Line 1)

After manually adding #!/usr/bin/env node to the dist bin script it works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions