Node.js 无法在Openshift上安装bower

Node.js 无法在Openshift上安装bower,node.js,openshift,bower,Node.js,Openshift,Bower,我无法在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

我无法在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
案例:2

{
    "directory": "public libs"
}
另外,尝试运行以下命令[在$HOME/app root/runtime/repo中]并尝试通过SSH shell安装npm bower

 npm cache clear
 npm cache clean
解决这个问题的任何帮助都将是巨大的


如果您想查看我的回购协议,可以在此处找到:

以下是我如何使用node.js盒带在OpenShift上使用
bower

先决条件:

  • 通常,您已经在全球范围内安装了Bower
  • 您推送到OpenShift的git repo必须配置为使用Bower,以便从repo的根目录执行
    Bower安装
必要步骤:

  • 创建文件
    .openshift/action\u hooks/deploy
  • 在添加并提交到repo之前,先执行chmod+x.openshift/action\u hooks/deploy,使其可执行
  • 将以下行添加到文件中:
  • #/usr/bin/env bash

    HOME=$HOME/app-root/runtime
    cd ~/repo
    npm install bower
    ./node_modules/.bin/bower install
    
  • 将文件添加并提交到git repo
  • 将您的git回购推送到OpenShift
  • 好的,对于每次需要使用
    bower安装
    ,您都可以在工具中使用
    export HOME=$HOME/app root/runtime/repo
    ,然后将其放入文件夹。'/app root/repo'您可以使用
    bower安装
    ,如果
    bower
    命令不可用,请转到文件夹'/nodejs'并执行
    npm install bower

    然后,为了使用工具(这对我来说非常有效):
    • 1-
      rhc ssh项目名称
    • 2-
      cd节点
    • 3-
      npm安装凉亭
    • 4-
      cd..
    • 5-
      export HOME=$HOME/app root/runtime/repo
    • 6-
      cd应用程序根目录/repo
    • 7-
      bower安装

    完成!祝你的项目好运 建议采用以下方法:

  • 添加依赖项
    “bower”:“latest”
    package.json
  • 为postinstall添加脚本:

    "scripts": {  
        ... 
        "postinstall": "HOME=$OPENSHIFT_REPO_DIR bower install || bower install"  
    },
    

  • 在我看来,这是bower和npm引擎之间的版本兼容性问题。Openshift上的npm版本是1.2.17,而Heroku和Cloudcontrol等其他平台都是1.4.x,bower安装的工作非常出色。Openshift中是否有升级npm引擎的方法?如果您在windows PC上,则需要运行:git update index--chmod=+x.Openshift/action\u hooks/deploy,而不是chmod+x.Openshift/action\u hooks/deploy
    "scripts": {  
        ... 
        "postinstall": "HOME=$OPENSHIFT_REPO_DIR bower install || bower install"  
    },