问题
I am unable to install bower on Openshift. I keep on getting errors like
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
You can see full deployment logs https://s3.amazonaws.com/archive.travis-ci.org/jobs/26291843/log.txt [From travis here].
I tried several approaches: 1) with and without .bowerrc file
case: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"
}
case:2
{
"directory": "public libs"
}
Also, tried running following commands [In $HOME/app-root/runtime/repo] and tried npm install bower by SSH shell
npm cache clear
npm cache clean
Any help to resolve this would be great.
In case you want to look at my repo you can find it here: https://github.com/prasunsultania/demoblog
回答1:
Here is how I made use of bower
on OpenShift using the node.js cartridge:
Prerequisites:
- Usually you have installed Bower globally.
- The git repo which you push to OpenShift must be readily configured for using Bower so that
bower install
from the root of the repo will do the job.
Necessary steps:
- Create the file
.openshift/action_hooks/deploy
- Do
chmod +x .openshift/action_hooks/deploy
to make it executable BEFORE you add and commit it to your repo - Add the following lines to the file:
#!/usr/bin/env bash
HOME=$HOME/app-root/runtime
cd ~/repo
npm install bower
./node_modules/.bin/bower install
- Add and commit the file to your git repo
- Push your git repo to OpenShift
回答2:
This suggests the following approach:
- Add dependency
"bower": "latest"
topackage.json
Add script for postinstall:
"scripts": { ... "postinstall": "HOME=$OPENSHIFT_REPO_DIR bower install || bower install" },
回答3:
well, for each time you need to use bower install
, you can use export HOME=$HOME/app-root/runtime/repo
in the RHC tool, and then into the folder './app-root/repo' you can use the bower install
, if bower
command is not available, go to folder './nodejs' and do npm install bower
.
Then, in order with RHC tool (this worked perfect to me):
-
1 -
rhc ssh proyect-name
-
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
done! good luck with your projects
来源:https://stackoverflow.com/questions/23937675/unable-to-install-bower-on-openshift