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

Unable to start local-dynamo - missing sheabang #47

Open
profiprog opened this issue Jan 22, 2019 · 0 comments
Open

Unable to start local-dynamo - missing sheabang #47

profiprog opened this issue Jan 22, 2019 · 0 comments

Comments

@profiprog
Copy link

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

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

1 participant