Sheabang should be added at first line of file: ./bin/launch_local_dynamo.js
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
Sheabang should be added at first line of file:
./bin/launch_local_dynamo.js#!/usr/bin/env nodeSteps to reproduce error:
last command produces error:
Workaround:
add under "scripts" in
package.jsonentry:manually or by command:
reinstall packages:
npm ciand run database:
npm test