Does elastic beanstalk run the postinstall from a package.json file

elastic-beanstalknode.js

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?

Best Answer

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.