如何在 openshift.redhat 上安装 Bower? "No compatible version found"

How to install bower on openshift.redhat? "No compatible version found"

我正在测试 openshift.redhat 免费计划。直到现在,我的部署还算顺利,直到我尝试安装 bower。上网搜索,有人推荐了以下食谱:

HOME=$OPENSHIFT_DAT_DIR  # as you cannot write to the home folder
npm install bower

通过以下,我得到

No compatible version found for abbrev;

那么,有人设法用 redhat openshift 安装了 bower 吗?

Command line utilities that are usually installed using the -g or --global flag will be automatically be added to the system $PATH, as long as they are included in the dependencies or devDependencies sections of the project’s package.json file.

https://developers.openshift.com/en/node-js-dependency-management.html

这意味着如果您在 package.json 中包含 Bower,您将能够在您的应用程序中正常使用 Bower。

"dependencies": {
  "bower": "^1.4.1",
}

我发现 运行 bower 更难...

我通过在我的 package.json

中添加这个来获得 bower 运行
"scripts": {
  "postinstall": "HOME=$OPENSHIFT_REPO_DIR bower install || bower install"
}

它适用于我的本地机器和 Openshift。

希望对您有所帮助