我无法在Openshift上安装bower。我一直在收到像
这样的错误remote: npm ERR! Error: ENOENT, lstat '/var/lib/openshift/537xxxxcd/app-root/runtime/repo/node_modules/bower/node_modules/mout/array/intersection.js'[K
remote: npm ERR! If you need help, you may report this log at:[K
remote: npm ERR! <http://github.com/isaacs/npm/issues>[K
remote: npm ERR! or email it to:[K
remote: npm ERR! <npm-@googlegroups.com>[K
您可以看到完整的部署日志https://s3.amazonaws.com/archive.travis-ci.org/jobs/26291843/log.txt [来自此处的travis]。
我尝试了几种方法: 1)有和没有.bowerrc文件
情况下:1
{
"directory": "~/app-root/runtime/repo/public/libs"
"storage": {
"cache": "~/app-root/runtime/repo/node_modules/bower/cache",
"completion": "~/app-root/runtime/repo/node_modules/bower/completion",
"git": "~/app-root/runtime/repo/node_modules/bower/git_template"
},
"interactive": "false",
"tmp":"~/app-root/runtime/repo/node_modules/bower/tmp",
"cwd":"~/app-root/runtime/repo"
}
情况下:2
{
"directory": "public libs"
}
此外,尝试运行以下命令[在$ HOME / app-root / runtime / repo]并尝试通过SSH shell安装bower
npm cache clear
npm cache clean
任何解决此问题的帮助都会很棒。
如果你想查看我的回购,你可以在这里找到它:https://github.com/prasunsultania/demoblog
答案 0 :(得分:16)
以下是我如何使用node.js盒式磁带在OpenShift上使用bower
:
先决条件:
bower install
能够完成工作。必要的步骤:
.openshift/action_hooks/deploy
chmod +x .openshift/action_hooks/deploy
使其成为可执行文件 #!/usr/bin/env bash
HOME=$HOME/app-root/runtime
cd ~/repo
npm install bower
./node_modules/.bin/bower install
答案 1 :(得分:6)
This建议采用以下方法:
"bower": "latest"
添加到package.json
为postinstall添加脚本:
"scripts": {
...
"postinstall": "HOME=$OPENSHIFT_REPO_DIR bower install || bower install"
},
答案 2 :(得分:0)
好吧,每次你需要使用bower install
,你可以在RHC工具中使用export HOME=$HOME/app-root/runtime/repo
,然后使用文件夹&#39; ./ app-root / repo&#39 ;您可以使用bower install
,如果bower
命令不可用,请转到文件夹&#39; ./ nodejs&#39;做npm install bower
。
然后,按照RHC工具的顺序(这对我来说很完美):
rhc ssh proyect-name
cd nodejs
npm install bower
cd ..
export HOME=$HOME/app-root/runtime/repo
cd app-root/repo
bower install
完成了!祝你的项目好运