Skip to content

Unable to start local-dynamo - missing sheabang #47

@profiprog

Description

@profiprog

Sheabang should be added at first line of file: ./bin/launch_local_dynamo.js

#!/usr/bin/env node

Steps to reproduce error:

mkdir test-local-dynamo
cd test-local-dynamo
npm init -y
npm install local-dynamo -S
# next command edit script "test" in package.json to start local-dynamo
sed -i '' -e 's/"test": ".*"[^"]*$/"test": "local-dynamo --port=8000"/' package.json
npm test

last command produces error:

./node_modules/.bin/local-dynamo: line 1: //: is a directory
./node_modules/.bin/local-dynamo: line 3: /Applications: is a directory
./node_modules/.bin/local-dynamo: line 4: node_modules: command not found
./node_modules/.bin/local-dynamo: line 5: node_modules/: is a directory
./node_modules/.bin/local-dynamo: line 7: syntax error near unexpected token `('
./node_modules/.bin/local-dynamo: line 7: `var flags = require('flags')'
npm ERR! Test failed.  See above for more details.

Workaround:
add under "scripts" in package.json entry:

"postinstall": "perl -i -pe '$.==1&&s%^%#!/usr/bin/env node\\n%' node_modules/local-dynamo/bin/launch_local_dynamo.js",

manually or by command:

perl -i -pe 's@^(.*"scripts": {)(.*)$@$1\n    "postinstall": "perl -i -pe '"'\\$.==1&&s%^%#\!\/usr\/bin\/env node\\\\\\\\n%'"' node_modules\/local-dynamo\/bin\/launch_local_dynamo.js",$2@' package.json

reinstall packages: npm ci
and run database: npm test

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