将 SailsJS应用部署到 Openshift
git push
remote: ├── express-handlebars@3.0.0 (graceful-fs@4.1.4, glob@6.0.4, object.assign@4.0.3, promise@7.1.1, handlebars@4.0.5)
remote: ├── skipper@0.5.9 (string_decoder@0.10.31, dot-access@1.0.0, async@1.4.2, colors@1.1.2, node-uuid@1.4.7, semver@5.0.3, skipper-disk@0.5.4, debug@2.2.0, multiparty@3.2.10, lodash@2.4.2
remote: ├── sails-util@0.11.0 (json-stringify-safe@5.0.1, fs-extra@0.8.1, optimist@0.6.1, underscore.string@2.3.3, switchback@1.1.3)
remote: ├── anchor@0.10.5
remote: ├── reportback@0.1.9 (merge-defaults@0.1.4, switchback@1.1.3, lodash@2.4.2)
remote: ├── grunt-cli@0.1.13 (nopt@1.0.10, resolve@0.3.1, findup-sync@0.1.3)
remote: ├── sails-stringfile@0.3.2 (colors@1.1.2, lodash@2.4.2)
remote: ├── sails-hook-sockets@0.13.7 (uid2@0.0.3, semver@4.3.6, socket.io-client@1.4.6, socket.io@1.4.6, machinepack-urls@3.1.1)
remote: └── waterline@0.11.2 (deep-diff@0.3.3, waterline-schema@0.2.0, async@1.5.2, bluebird@3.2.1, switchback@2.0.0, anchor@0.11.2, waterline-criteria@0.11.2)
remote: npm info ok
remote: Preparing build for deployment
remote: Deployment id is bf24b845
remote: Activating deployment
remote: Loading "bower_task.js" tasks...ERROR
remote: >> Error: EACCES, permission denied '/var/lib/openshift/574f48527628e1bce8000273/.local'
remote: Warning: Task "bower:install" not found. Use --force to continue.
remote:
remote: Aborted due to warnings.
remote: -------------------------
remote: Git Post-Receive Result: failure
remote: Activation status: failure
remote: Activation failed for the following gears:
remote: 574f48527628e1bce8000273 (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/574f48527628e1bce8000273/nodejs
remote: #<IO:0x0000000069e290>
remote: #<IO:0x0000000069e218>
remote: )
remote: Deployment completed with status: failure
remote: postreceive failed
To ssh://574f48527628e1bce8000273@myapp.rhcloud.com/~/git/webrtc.git
df77e95..dc8b186 HEAD -> master
任何想法如何解决这个问题?
添加动作挂钩。建议在this thread
cd .openshift/action_hooks
我已将代码添加到现有的操作挂钩pre_start_nodejs
#!/bin/bash
export NODE_ENV=production
if [ ! -d $OPENSHIFT_NODEJS_DIR/node_modules/bower ]
then
cd $OPENSHIFT_NODEJS_DIR
npm install bower
fi
cd $OPENSHIFT_HOMEDIR/app-root/repo
HOME=$OPENSHIFT_REPO_DIR bower install
cd $OPENSHIFT_HOMEDIR
if [ -f "${OPENSHIFT_REPO_DIR}"/Gruntfile.js ]; then
(cd "${OPENSHIFT_REPO_DIR}"; node_modules/grunt-cli/bin/grunt prod)
fi
这有助于我前进,但我仍然坚持Error: EACCES, permission denied
到.local
在package.json
中添加了
"build": "HOME=$HOME/app-root/runtime bower install --config.interactive=false && grunt build",
但也没有帮助
1 - rhc ssh proyectname
2 - cd nodejs
3 - npm install bower
4 - cd ..
5 - export HOME=$HOME/app-root/runtime/repo
6 - cd app-root/repo
7 - bower install
未解决
我没有想法。
我了解bower
无权访问.local
,但不知道如何解决
答案 0 :(得分:0)
这有助于比照Source
EACCESS, permission denied '/var/lib/openshift/[instance-id]/.local'
错误消息表示您没有写入主文件夹的权限。
在package.json
"scripts": {
"postinstall": "export HOME=/var/lib/openshift/574fce8000273/app-root/runtime/repo; ./node_modules/bower/bin/bower install", <========
"debug": "node debug app.js",
"start": "node app.js"
},
和 Bower 已完成安装