我package.json
有:如何为AWS Elastic Beanstalk部署运行npm脚本?
"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"
},
当我部署到弹性魔豆,我想运行postinstall
,但显然没有做到这一点。好的没问题。
我创建了一个名为.ebextensions/00.decrypt.config
文件,该文件有:
commands:
00-add-home-variable:
command: sed -i 's/function error_exit/export HOME=\/root\n\nfunction error_exit/' /opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh
container_commands:
02-decrypt-config:
command: $NODE_HOME/bin/npm run decryptConfig
然而,这似乎并不要么运行。我做错了什么?
尝试引用你的命令,这是一个要求 – sap1ens
另外,不知道是否$ NODE_HOME工作 - 你可以运行简单的测试,如echo $ NODE_HOME> /tmp/test.txt? – sap1ens
您可以检查/var/log/eb-activity.log和/var/log/eb-commandprocessor.log。这些文件会告诉你这些命令执行时发生了什么。 –