4

I am using elastic beanstalk to deploy a node.js app. In my scripts section of package.json I have:

  "scripts": {
    "start": "node_modules/.bin/coffee server.coffee",
    "test": "NODE_ENV=test node test/runner.js",
    "coverage": "NODE_ENV=test COVERAGE=1 node test/runner.js -R html-cov test/ > ./test/coverage.html",
    "testw": "fswatch -o test src | xargs -n1 -I{} sh -c 'coffeelint src server.coffee ; npm test'",
    "db:drop": "node scripts/drop-tables.js",
    "encryptConfig": "node_modules/.bin/coffee config/encrypt.coffee",
    "decryptConfig": "node_modules/.bin/coffee config/decrypt.coffee",
    "postinstall": "npm run decryptConfig"
  },

The npm install seems to work. But the postinstall does not execute. Is this a known issue? If so, how can I execute something post npm install but before npm start?

7

I've just come across this problem too. I found that a postinstall script would not run but a prestart would. Mine looks like this:

"scripts": {
    "start": "node index.js",
    "prestart": "node node_modules/webpack/bin/webpack.js"
}

That now correctly bundles my webpack stuff before starting the server when I run eb deploy locally.

1

I think you meant that you are using EB (Elastic Beanstalk) ELB being the load balancer. Elastic Beanstalk is running npm start by default to run your application. I recommend you to package your modules with your application in your build process.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.