OpenShift 与 socket.io,npm install 无法读取依赖项



在尝试使用socket.io构建openshift上的node.js服务器时,发生以下错误。

npm ERR! install Couldn't read dependencies
npm ERR! install Couldn't read dependencies
npm ERR! Linux 3.10.0-753.el7xtsync.x86_64 
npm ERR! argv "/opt/rh/rh-nodejs4/root/usr/bin/node" "/opt/rh/rh-nodejs4   /root/usr/bin/npm" "install"
npm ERR! node v4.6.2
npm ERR! npm  v2.15.1
npm ERR! file /opt/app-root/src/package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Cannot find module './lib/parse'
npm ERR! File: /opt/app-root/src/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR! 
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! Please include the following file with any support request:
npm ERR! /opt/app-root/src/npm-debug.log

但是,代码在我的本地计算机上运行良好,没有任何错误

我使用以下软件包。JSON

{
  "name": "socket_thing",
  "version": "0.0.1",
  "description": "To make a server plugin for superpowers",
  "scripts": {
    "start": "node server.js"
  },
  "main": "server.js",
  "dependencies": {
    "express": "^4.15.2",
    "socket.io": "^2.0.4"
  }
}

有什么原因是为什么依赖性在OpenShift上的处理方式有所不同,因为这似乎是问题所在?

,因此似乎使用Express

的最新版本
"express": "^4.16.2"

package.json解决了问题。

最新更新