Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js openshift with socket.io,npm安装';不读依赖项_Node.js_Socket.io_Openshift - Fatal编程技术网

Node.js openshift with socket.io,npm安装';不读依赖项

Node.js openshift with socket.io,npm安装';不读依赖项,node.js,socket.io,openshift,Node.js,Socket.io,Openshift,尝试在openshift上使用socket.io构建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

尝试在openshift上使用socket.io构建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
但是,代码在本地计算机上运行良好,没有任何错误

我使用以下package.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中解决了这个问题