无法在Openshift上安装bower

pra*_*sun 7 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
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
Run Code Online (Sandbox Code Playgroud)

您可以看到完整的部署日志https://s3.amazonaws.com/archive.travis-ci.org/jobs/26291843/log.txt [来自travis here].

我尝试了几种方法: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"
}
Run Code Online (Sandbox Code Playgroud)

案例:2

{
    "directory": "public libs"
}
Run Code Online (Sandbox Code Playgroud)

尝试运行以下命令[在$ HOME/app-root/runtime/repo]并尝试通过SSH shell运行npm install bower

 npm cache clear
 npm cache clean
Run Code Online (Sandbox Code Playgroud)

解决这个问题的任何帮助都会很棒.

如果你想查看我的回购,你可以在这里找到它:https: //github.com/prasunsultania/demoblog

ana*_*ico 16

以下是我使用bowernode.js盒式磁带在OpenShift上的使用方法:

先决条件:

  • 通常您已在全球范围内安装了Bower.
  • 您推送到OpenShift的git repo必须很容易配置为使用Bower,以便bower install从repo的根目录完成工作.

必要的步骤:

  1. 创建文件 .openshift/action_hooks/deploy
  2. 不要chmod +x .openshift/action_hooks/deploy让它可执行文件之前,可以添加和提交到您的回购
  3. 将以下行添加到文件中:

#!/usr/bin/env bash

HOME=$HOME/app-root/runtime
cd ~/repo
npm install bower
./node_modules/.bin/bower install
Run Code Online (Sandbox Code Playgroud)
  1. 添加文件并将其提交到您的git仓库
  2. 将你的git repo推送到OpenShift

  • 如果您使用的是Windows PC,则需要运行:git update-index --chmod = + x .openshift/action_hooks/deploy而不是chmod + x .openshift/action_hooks/deploy (3认同)

dmi*_*igo 6

表明以下方法:

  1. 添加依赖"bower": "latest"package.json
  2. 为postinstall添加脚本:

    "scripts": {  
        ... 
        "postinstall": "HOME=$OPENSHIFT_REPO_DIR bower install || bower install"  
    },
    
    Run Code Online (Sandbox Code Playgroud)