Openshift部署错误:无法找到模块package.json

问题描述:

我试图通过使用webpack绑定我的节点文件,然后只是推它,以减少我的openshift后端节点应用程序的大小。下面是我得到的错误:Openshift部署错误:无法找到模块package.json

Total 642 (delta 200), reused 2 (delta 0) 
remote: module.js:471 
remote:  throw err; 
remote: ^
remote: 
remote: Error: Cannot find module '/var/lib/openshift/575efb722d5271dec00000f4/app-root/runtime/repo//package.json' 
remote:  at Function.Module._resolveFilename (module.js:469:15) 
remote:  at Function.Module._load (module.js:417:25) 
remote:  at Module.require (module.js:497:17) 
remote:  at require (internal/module.js:20:19) 
remote:  at [eval]:1:9 
remote:  at ContextifyScript.Script.runInThisContext (vm.js:25:33) 
remote:  at Object.runInThisContext (vm.js:97:38) 
remote:  at Object.<anonymous> ([eval]-wrapper:6:22) 
remote:  at Module._compile (module.js:570:32) 
remote:  at evalScript (bootstrap_node.js:353:27) 
remote: CLIENT_MESSAGE: Stopping Node.js application... 
Connection to api-tmarr.rhcloud.com closed by remote host. 
fatal: The remote end hung up unexpectedly 

这里是我的WebPack配置文件:

var webpack = require('webpack'); 
var path = require('path'); 
var fs = require('fs'); 

var nodeModules = {}; 
fs.readdirSync('node_modules') 
    .filter(function(x) { 
    return ['.bin'].indexOf(x) === -1; 
    }) 
    .forEach(function(mod) { 
    nodeModules[mod] = 'commonjs ' + mod; 
    }); 

module.exports = { 
    entry: './src/app.js', 
    target: 'node', 
    output: { 
    path: path.join(__dirname, 'build'), 
    filename: 'backend.js' 
    }, 
    externals: nodeModules, 
    plugins: [ 
    new webpack.IgnorePlugin(/\.(css|less)$/), 

    new webpack.BannerPlugin({banner: 'require("source-map-support").install();', raw: true, entryOnly: false}) 
    ], 
    devtool: 'sourcemap' 
} 

它创建了一个backend.js文件,然后复制到刚刚有一个骨架项目在它最低限度,并与Git钩住了openshift。这个新的骨架项目有它自己的package.json & start.js文件。

的package.json:

{ 
    "name": "API", 
    "version": "1.0.1", 
    "description": "Terry's API Server", 
    "private": true, 
    "main": "start.js", 
    "scripts": { 
    "prestart": "NODE_ENV=production", 
    "start": "node --use_strict start.js --websocket-port=$OPENSHIFT_NODEJS_PORT --log-level=1" 
    }, 
    "author": "Terry Marr", 
    "license": "ISC", 
    "dependencies": { 
    "cors": "^2.8.1", 
    "express": "~3.4.4", 
    "express-cache-ctrl": "^1.0.1" 
    }, 

    "engines": { 
    "node": ">= 0.6.0", 
    "npm": ">= 1.0.0" 
    }, 
    "devDependencies": {} 
} 

这里是导致骨骼结构:

/build 
    -backend.js 
    -backend.js.map 
/node_modules ... 
/static ... 
/utils ... 
-.gitignore 
-package.json 
-start.js 

这可能是重要的是什么,我试图做的是REDO我的应用程序。它没有webpack之前工作。也许从旧代码中有什么东西?相当新的Openshift,并找到文档不是很有帮助。我应该在那里清除我的代码并重新打包吗?不知道该怎么做。欣赏任何帮助。

更新:没有人回答我的问题,并且Openshift的支持真的咬人。他们的文档很糟糕,当你被困时,绝对没有人可以提供帮助。我拉我的(付费)应用程序,并转移到Heroku。