我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。這些文件會告訴你這些命令執行時發生了什麼。 –