在Openshift上运行MEAN站点时,非常奇怪的Mongoose/MongoDB问题 [英] Very weird Mongoose/MongoDB issue when running MEAN site on Openshift

查看:55
本文介绍了在Openshift上运行MEAN站点时,非常奇怪的Mongoose/MongoDB问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将网站上传到Openshift ...我不得不进行很多更改...包括学习有关版本控制和nvm(节点版本管理器)的知识.为了使请求发生,我不得不经历很多npm版本的东西(即,服务器在本地使用Express版本3.2.5,而我在本地使用4.2.0).无论如何,现在我正处在这个奇怪的问题上,猫鼬函数-Model.findById()似乎根本无法通过_id属性找到数据库中明显存在的对象.流程是这样的(您可以在这里亲自查看- http://hackabox-eamonbenproject.rhcloud.com -我的项目):

I have uploaded a site to Openshift...I have had to make many changes...including learning about version-ing and nvm (Node Version Manager). I had to go through a lot of npm version stuff just to make the requests happen (namely, the server used express version 3.2.5, while I was using 4.2.0, locally). Anyway, now I am on this weird problem where the mongoose function - Model.findById() simply doesn't seem to be able to find an object that is clearly in the database by the _id attribute. The flow is like this (and you can see it for yourself here - http://hackabox-eamonbenproject.rhcloud.com - my project):

当我尝试在可以查看所有帖子信息的页面上加载帖子时...发生GET请求时,此处通过express调用了一条路线:

When I try to load a post on the page where you can view all the post info...the GET request happens, a route is called by express here:

app.get('/api/posts/:id', api.showinfo);

api.showinfo函数当前是这个函数(尽管我尝试了许多不同的操作):

That api.showinfo function is this currently (although I have tried many different things):

exports.showinfo = function(req, res, next) {
  var postId = req.params.id;

  Post.findById(postId, function (err, post) {
    console.log("what did u find?" + post);
    res.send({ postinfo: post.postinfo });
    //res.json(post);
  });
};

console.log("what did u find?" + post)输出null,这意味着猫鼬的findById功能出了问题.

That console.log("what did u find?" + post) outputs null, which means that something with mongoose's findById function is going wrong.

我已登录以确保postId是正确的ID ...所以这不是问题.我也尝试过将res.send({ postinfo: post.postinfo });更改为res.json(post)res.send(post.postinfo)res.send({ profile: post.postinfo })-没运气.

I have logged to make sure that postId is the correct id...so that isn't the problem. I have also tried changing res.send({ postinfo: post.postinfo }); to res.json(post), res.send(post.postinfo), res.send({ profile: post.postinfo }) - with no luck.

有人知道为什么findById可能找不到任何东西吗... post.postinfo指的是我的Mongoose虚拟架构,如下所示:

Does anyone know why findById might not be finding anything...the post.postinfo refers to my Mongoose virtual schema which looks like this:

PostSchema
  .virtual('postinfo')
    .get(function() {
      return {
        '_id': this._id,
        'posttitle': this.posttitle,
        'content': this.content,
        'username': this.username,
        'date': this.date
      };
    });

我认为将它与res.send一起使用在种子中的用户身份验证系统中可能会起作用-像这样在其中使用-并且工作正常:

I thought using it with res.send how it is used in the user auth system in my seed might work - it is used there like this - and it works fine:

exports.show = function (req, res, next) {
  var userId = req.params.id;

  User.findById(userId, function (err, user) {
    if (err) return next(err);
    if (!user) return res.send(404);

    res.send({ profile: user.profile });
  });
};

出于某种原因,当我将其与我制作的Post模型一起使用时,它不想在Openshift上运行,我很确定它可以在本地运行.

For some reason when I use it with the Post model I made, it doesn't want to work on Openshift, I'm pretty sure it works locally.

有什么想法吗?

更新

在将我的MongoDB版本本地降级到2.4.6(与openshift服务器版本相同)后,该站点开始出现与服务器上相同的本地问题...所以这肯定是环境问题-我猜一些依赖Mongo的软件包也需要更改其版本-因此,我将尝试一下,看看是否有帮助.现在我在本地运行时,种子内的版本冲突似乎是一个问题-这是我package.json文件中所有与mongo相关的npm软件包:

After downgrading my MongoDB version locally to 2.4.6 (same as openshift server version) - the site started having the same problems locally that it does on the server...so it is definitely an environment issue - I'm guessing that some of the packages that depend on Mongo need their versions changed too - so I am going to try that and see if that helps. It seems to be a problem with conflicting versions within the seed when I run it locally now - here are all the mongo related npm packages from my package.json file:

{
  "name": "hackabox",
  "version": "0.0.0",
  "dependencies": {

    ...

    "mongoose": "~3.8.8",
    "connect-mongo": "mrzepinski/connect-mongo#2135988",

    ...
  },

  ...

}

有人知道MongoDB v2.4.6使用什么版本吗?

Does anyone know what versions to use for MongoDB v2.4.6?

更新

我尝试了Mongoose v3.5.0,但它不起作用-我正在查看提交日期,似乎在MongoDB v2.4.6发行之时.还需要更新/降级其他哪些软件包才能与openshift服务器同步?

I tried Mongoose v3.5.0 and it doesn't work - I was looking at the commit dates and it seemed like around the time that MongoDB v2.4.6 was released. What other packages need to be updated/downgraded to sync with the openshift server?

更新

做了几件事,没有运气-但最终我最终还是进入了openshift服务器并开始运行:

Did a few things, with no luck - but ultimately I ended up ssh-ing into the openshift server and running:

npm list -g --depth=0

它以EACCES错误作为响应-但无论如何它也会吐出所有版本号-因此,它们是:

It responded with an EACCES error - but it also spat out all the version numbers anyway - so here they are:

glob error { [Error: EACCES, readdir '/opt/rh/nodejs010/root/usr/lib/node_modules/npm/man']
  errno: 3,
  code: 'EACCES',
  path: '/opt/rh/nodejs010/root/usr/lib/node_modules/npm/man' }
/opt/rh/nodejs010/root/usr/lib
├── abbrev@1.0.4
├── ansi@0.2.1
├── ansicolors@0.3.2
├── ansistyles@0.1.3
├── archy@0.0.2
├── asn1@0.1.11
├── assert-plus@0.1.4
├── async@0.2.9
├── aws-sign@0.3.0
├── bignumber.js@1.1.1
├── block-stream@0.0.7
├── boom@0.4.2
├── bson@0.2.3
├── buffer-crc32@0.2.1
├── bytes@0.2.1
├── child-process-close@0.1.1
├── chmodr@0.1.0
├── chownr@0.0.1
├── cmd-shim@1.1.0
├── colors@0.6.2
├── columnify@0.1.2
├── combined-stream@0.0.4
├── commander@1.1.1
├── config-chain@1.1.8
├── connect@2.7.10
├── cookie@0.1.0
├── cookie-jar@0.3.0
├── cookie-signature@1.0.1
├── couch-login@0.1.18
├── cryptiles@0.2.2
├── ctype@0.5.3
├── debug@0.7.2
├── delayed-stream@0.0.5
├── editor@0.0.5
├── express@3.2.5
├── forever-agent@0.5.0
├── form-data@0.1.1
├── formidable@1.0.14
├── fresh@0.2.0
├── fstream@0.1.25
├── fstream-ignore@0.0.7
├── fstream-npm@0.1.6
├── generic-pool@2.0.3
├── github-url-from-git@1.1.1
├── github-url-from-username-repo@0.0.2
├── glob@3.2.8
├── graceful-fs@2.0.0
├── hawk@1.0.0
├── hoek@0.9.1
├── http-signature@0.10.0
├── inherits@2.0.0
├── ini@1.1.0
├── init-package-json@0.0.14
├── json-stringify-safe@5.0.0
├── keypress@0.2.1
├── lockfile@0.4.2
├── lru-cache@2.5.0
├── methods@0.0.1
├── mime@1.2.11
├── minimatch@0.2.14
├── mkdirp@0.3.5
├── mongodb@1.3.19
├── mute-stream@0.0.4
├── mysql@2.0.0-alpha9
├── nan@0.4.4
├── node-gyp@0.12.2
├── node-static@0.6.9
├── node-uuid@1.4.1
├── nopt@2.1.2
├── normalize-package-data@0.2.8
├── npm@*
├── npm-registry-client@0.3.3
├── npm-user-validate@0.0.3
├── npmconf@0.1.12
├── npmlog@0.0.6
├── oauth-sign@0.3.0
├── once@1.3.0
├── opener@1.3.0
├── openshift-node-web-proxy@*
├── optimist@0.4.0
├── options@0.0.5
├── osenv@0.0.3
├── path-is-inside@1.0.0
├── pause@0.0.1
├── pg@0.12.3
├── promzard@0.2.0
├── proto-list@1.2.2
├── qs@0.6.5
├── range-parser@0.0.4
├── read@1.0.5
├── read-installed@0.2.4
├── read-package-json@1.1.6
├── request@2.25.0
├── require-all@0.0.8
├── retry@0.6.0
├── rimraf@2.2.6
├── semver@2.1.0
├── send@0.1.4
├── sha@1.2.1
├── sigmund@1.0.0
├── slide@1.1.5
├── sntp@0.2.4
├── supervisor@0.5.2
├── tar@0.1.19
├── text-table@0.2.0
├── tinycolor@0.0.1
├── tunnel-agent@0.3.0
├── uid-number@0.0.3
├── which@1.0.5
├── wordwrap@0.0.2
└── ws@0.4.25

我真的需要使所有全局npm软件包与openshift上的软件包具有相同的版本,以确保它起作用(对于相关的软件包)吗?

Do I really need to go about making all my global npm packages the same versions as the packages that are on openshift to insure that it works (for the ones that are relevant)?

我在本地运行npm list -g-这就是我得到的:

I ran npm list -g locally - and this is what I get:

/usr/lib
├─┬ bower@1.3.3
│ ├── abbrev@1.0.5
│ ├── archy@0.0.2
│ ├─┬ bower-config@0.5.0
│ │ ├── mout@0.6.0
│ │ └─┬ optimist@0.6.1
│ │   ├── minimist@0.0.8
│ │   └── wordwrap@0.0.2
│ ├── bower-endpoint-parser@0.2.1
│ ├─┬ bower-json@0.4.0
│ │ ├── deep-extend@0.2.8
│ │ └── intersect@0.0.3
│ ├── bower-logger@0.2.2
│ ├─┬ bower-registry-client@0.2.0
│ │ ├── async@0.2.10
│ │ ├─┬ bower-config@0.4.5
│ │ │ ├── mout@0.6.0
│ │ │ └─┬ optimist@0.6.1
│ │ │   ├── minimist@0.0.8
│ │ │   └── wordwrap@0.0.2
│ │ ├── lru-cache@2.3.1
│ │ ├─┬ request@2.27.0
│ │ │ ├── aws-sign@0.3.0
│ │ │ ├── cookie-jar@0.3.0
│ │ │ ├── forever-agent@0.5.2
│ │ │ ├─┬ form-data@0.1.2
│ │ │ │ └─┬ combined-stream@0.0.4
│ │ │ │   └── delayed-stream@0.0.5
│ │ │ ├─┬ hawk@1.0.0
│ │ │ │ ├── boom@0.4.2
│ │ │ │ ├── cryptiles@0.2.2
│ │ │ │ ├── hoek@0.9.1
│ │ │ │ └── sntp@0.2.4
│ │ │ ├─┬ http-signature@0.10.0
│ │ │ │ ├── asn1@0.1.11
│ │ │ │ ├── assert-plus@0.1.2
│ │ │ │ └── ctype@0.5.2
│ │ │ ├── json-stringify-safe@5.0.0
│ │ │ ├── mime@1.2.11
│ │ │ ├── node-uuid@1.4.1
│ │ │ ├── oauth-sign@0.3.0
│ │ │ ├── qs@0.6.6
│ │ │ └── tunnel-agent@0.3.0
│ │ └── request-replay@0.2.0
│ ├─┬ cardinal@0.4.4
│ │ ├── ansicolors@0.2.1
│ │ └─┬ redeyed@0.4.4
│ │   └── esprima@1.0.4
│ ├─┬ chalk@0.4.0
│ │ ├── ansi-styles@1.0.0
│ │ ├── has-color@0.1.7
│ │ └── strip-ansi@0.1.1
│ ├── chmodr@0.1.0
│ ├─┬ decompress-zip@0.0.6
│ │ ├─┬ binary@0.3.0
│ │ │ ├── buffers@0.1.1
│ │ │ └─┬ chainsaw@0.1.0
│ │ │   └── traverse@0.3.9
│ │ ├── mkpath@0.1.0
│ │ ├─┬ readable-stream@1.1.13-1
│ │ │ ├── core-util-is@1.0.1
│ │ │ ├── inherits@2.0.1
│ │ │ ├── isarray@0.0.1
│ │ │ └── string_decoder@0.10.25-1
│ │ └─┬ touch@0.0.2
│ │   └── nopt@1.0.10
│ ├─┬ fstream@0.1.25
│ │ └── inherits@2.0.1
│ ├─┬ fstream-ignore@0.0.7
│ │ ├── inherits@2.0.1
│ │ └─┬ minimatch@0.2.14
│ │   └── sigmund@1.0.0
│ ├─┬ glob@3.2.9
│ │ ├── inherits@2.0.1
│ │ └─┬ minimatch@0.2.14
│ │   └── sigmund@1.0.0
│ ├── graceful-fs@2.0.3
│ ├─┬ handlebars@1.3.0
│ │ ├─┬ optimist@0.3.7
│ │ │ └── wordwrap@0.0.2
│ │ └─┬ uglify-js@2.3.6
│ │   ├── async@0.2.10
│ │   └─┬ source-map@0.1.33
│ │     └── amdefine@0.1.0
│ ├─┬ inquirer@0.4.1
│ │ ├── async@0.2.10
│ │ ├─┬ cli-color@0.2.3
│ │ │ ├── es5-ext@0.9.2
│ │ │ └─┬ memoizee@0.2.6
│ │ │   ├── event-emitter@0.2.2
│ │ │   └── next-tick@0.1.0
│ │ ├── lodash@2.4.1
│ │ ├── mute-stream@0.0.4
│ │ ├── readline2@0.1.0
│ │ └── through@2.3.4
│ ├─┬ insight@0.3.1
│ │ ├── async@0.2.10
│ │ ├─┬ configstore@0.2.3
│ │ │ ├─┬ js-yaml@3.0.2
│ │ │ │ ├─┬ argparse@0.1.15
│ │ │ │ │ ├── underscore@1.4.4
│ │ │ │ │ └── underscore.string@2.3.3
│ │ │ │ └── esprima@1.0.4
│ │ │ └── uuid@1.4.1
│ │ ├─┬ lodash.debounce@2.4.1
│ │ │ ├── lodash.isfunction@2.4.1
│ │ │ ├─┬ lodash.isobject@2.4.1
│ │ │ │ └── lodash._objecttypes@2.4.1
│ │ │ └─┬ lodash.now@2.4.1
│ │ │   └── lodash._isnative@2.4.1
│ │ ├── object-assign@0.1.2
│ │ └─┬ request@2.27.0
│ │   ├── aws-sign@0.3.0
│ │   ├── cookie-jar@0.3.0
│ │   ├── forever-agent@0.5.2
│ │   ├─┬ form-data@0.1.2
│ │   │ └─┬ combined-stream@0.0.4
│ │   │   └── delayed-stream@0.0.5
│ │   ├─┬ hawk@1.0.0
│ │   │ ├── boom@0.4.2
│ │   │ ├── cryptiles@0.2.2
│ │   │ ├── hoek@0.9.1
│ │   │ └── sntp@0.2.4
│ │   ├─┬ http-signature@0.10.0
│ │   │ ├── asn1@0.1.11
│ │   │ ├── assert-plus@0.1.2
│ │   │ └── ctype@0.5.2
│ │   ├── json-stringify-safe@5.0.0
│ │   ├── mime@1.2.11
│ │   ├── node-uuid@1.4.1
│ │   ├── oauth-sign@0.3.0
│ │   ├── qs@0.6.6
│ │   └── tunnel-agent@0.3.0
│ ├── is-root@0.1.0
│ ├── junk@0.3.0
│ ├── lockfile@0.4.2
│ ├── lru-cache@2.5.0
│ ├── mkdirp@0.3.5
│ ├── mout@0.9.1
│ ├── nopt@2.2.0
│ ├── opn@0.1.1
│ ├── osenv@0.0.3
│ ├─┬ p-throttler@0.0.1
│ │ └── q@0.9.7
│ ├─┬ promptly@0.2.0
│ │ └─┬ read@1.0.5
│ │   └── mute-stream@0.0.4
│ ├── q@1.0.1
│ ├─┬ request@2.34.0
│ │ ├── aws-sign2@0.5.0
│ │ ├── forever-agent@0.5.2
│ │ ├─┬ form-data@0.1.2
│ │ │ ├── async@0.2.10
│ │ │ └─┬ combined-stream@0.0.4
│ │ │   └── delayed-stream@0.0.5
│ │ ├─┬ hawk@1.0.0
│ │ │ ├── boom@0.4.2
│ │ │ ├── cryptiles@0.2.2
│ │ │ ├── hoek@0.9.1
│ │ │ └── sntp@0.2.4
│ │ ├─┬ http-signature@0.10.0
│ │ │ ├── asn1@0.1.11
│ │ │ ├── assert-plus@0.1.2
│ │ │ └── ctype@0.5.2
│ │ ├── json-stringify-safe@5.0.0
│ │ ├── mime@1.2.11
│ │ ├── node-uuid@1.4.1
│ │ ├── oauth-sign@0.3.0
│ │ ├── qs@0.6.6
│ │ ├─┬ tough-cookie@0.12.1
│ │ │ └── punycode@1.2.4
│ │ └── tunnel-agent@0.3.0
│ ├─┬ request-progress@0.3.1
│ │ └── throttleit@0.0.2
│ ├── retry@0.6.0
│ ├── rimraf@2.2.6
│ ├── semver@2.2.1
│ ├─┬ shell-quote@1.4.1
│ │ ├── array-filter@0.0.1
│ │ ├── array-map@0.0.0
│ │ ├── array-reduce@0.0.0
│ │ └── jsonify@0.0.0
│ ├── stringify-object@0.2.0
│ ├─┬ tar@0.1.19
│ │ ├── block-stream@0.0.7
│ │ └── inherits@2.0.1
│ ├── tmp@0.0.23
│ ├─┬ update-notifier@0.1.8
│ │ ├─┬ configstore@0.2.3
│ │ │ ├─┬ js-yaml@3.0.2
│ │ │ │ ├─┬ argparse@0.1.15
│ │ │ │ │ ├── underscore@1.4.4
│ │ │ │ │ └── underscore.string@2.3.3
│ │ │ │ └── esprima@1.0.4
│ │ │ ├── object-assign@0.1.2
│ │ │ └── uuid@1.4.1
│ │ ├─┬ request@2.27.0
│ │ │ ├── aws-sign@0.3.0
│ │ │ ├── cookie-jar@0.3.0
│ │ │ ├── forever-agent@0.5.2
│ │ │ ├─┬ form-data@0.1.2
│ │ │ │ ├── async@0.2.10
│ │ │ │ └─┬ combined-stream@0.0.4
│ │ │ │   └── delayed-stream@0.0.5
│ │ │ ├─┬ hawk@1.0.0
│ │ │ │ ├── boom@0.4.2
│ │ │ │ ├── cryptiles@0.2.2
│ │ │ │ ├── hoek@0.9.1
│ │ │ │ └── sntp@0.2.4
│ │ │ ├─┬ http-signature@0.10.0
│ │ │ │ ├── asn1@0.1.11
│ │ │ │ ├── assert-plus@0.1.2
│ │ │ │ └── ctype@0.5.2
│ │ │ ├── json-stringify-safe@5.0.0
│ │ │ ├── mime@1.2.11
│ │ │ ├── node-uuid@1.4.1
│ │ │ ├── oauth-sign@0.3.0
│ │ │ ├── qs@0.6.6
│ │ │ └── tunnel-agent@0.3.0
│ │ └── semver@2.1.0
│ └── which@1.0.5
├─┬ express@3.2.5
│ ├── buffer-crc32@0.2.1
│ ├── commander@0.6.1
│ ├─┬ connect@2.7.10
│ │ ├── bytes@0.2.0
│ │ ├── cookie@0.0.5
│ │ ├── formidable@1.0.14
│ │ ├── pause@0.0.1
│ │ └── qs@0.6.5
│ ├── cookie@0.1.0
│ ├── cookie-signature@1.0.1
│ ├─┬ debug@1.0.4
│ │ └── ms@0.6.2
│ ├── fresh@0.1.0
│ ├── methods@0.0.1
│ ├── mkdirp@0.3.4
│ ├── range-parser@0.0.4
│ └─┬ send@0.1.0
│   └── mime@1.2.6
├─┬ express-generator@4.2.0
│ ├─┬ commander@1.3.2
│ │ └── keypress@0.1.0
│ └── mkdirp@0.3.5
├─┬ generator-angular@0.8.0
│ ├─┬ chalk@0.4.0
│ │ ├── ansi-styles@1.0.0
│ │ ├── has-color@0.1.7
│ │ └── strip-ansi@0.1.1
│ ├─┬ wiredep@1.0.0
│ │ ├─┬ chalk@0.1.1
│ │ │ ├── ansi-styles@0.1.2
│ │ │ └── has-color@0.1.7
│ │ ├─┬ glob@3.2.11
│ │ │ ├── inherits@2.0.1
│ │ │ └─┬ minimatch@0.3.0
│ │ │   ├── lru-cache@2.5.0
│ │ │   └── sigmund@1.0.0
│ │ └── lodash@1.3.1
│ └─┬ yeoman-generator@0.16.0
│   ├── async@0.2.10
│   ├─┬ cheerio@0.13.1
│   │ ├─┬ CSSselect@0.4.1
│   │ │ ├── CSSwhat@0.4.7
│   │ │ └─┬ domutils@1.4.3
│   │ │   └── domelementtype@1.1.1
│   │ ├── entities@0.5.0
│   │ ├─┬ htmlparser2@3.4.0
│   │ │ ├── domelementtype@1.1.1
│   │ │ ├── domhandler@2.2.0
│   │ │ ├── domutils@1.3.0
│   │ │ └─┬ readable-stream@1.1.13-1
│   │ │   ├── core-util-is@1.0.1
│   │ │   ├── inherits@2.0.1
│   │ │   ├── isarray@0.0.1
│   │ │   └── string_decoder@0.10.25-1
│   │ └── underscore@1.5.2
│   ├── class-extend@0.1.1
│   ├── dargs@0.1.0
│   ├── debug@0.7.4
│   ├── diff@1.0.8
│   ├─┬ download@0.1.17
│   │ ├─┬ decompress@0.2.3
│   │ │ ├── adm-zip@0.4.4
│   │ │ ├─┬ extname@0.1.2
│   │ │ │ └── ext-list@0.1.0
│   │ │ ├── map-key@0.1.4
│   │ │ ├─┬ stream-combiner@0.0.4
│   │ │ │ └── duplexer@0.1.1
│   │ │ ├─┬ tar@0.1.19
│   │ │ │ ├── block-stream@0.0.7
│   │ │ │ ├─┬ fstream@0.1.25
│   │ │ │ │ └── graceful-fs@2.0.3
│   │ │ │ └── inherits@2.0.1
│   │ │ └─┬ tempfile@0.1.3
│   │ │   └── uuid@1.4.1
│   │ ├── each-async@0.1.3
│   │ ├── get-stdin@0.1.0
│   │ ├── get-urls@0.1.2
│   │ ├─┬ nopt@2.2.1
│   │ │ └── abbrev@1.0.5
│   │ ├─┬ request@2.36.0
│   │ │ ├── aws-sign2@0.5.0
│   │ │ ├── forever-agent@0.5.2
│   │ │ ├─┬ form-data@0.1.2
│   │ │ │ └─┬ combined-stream@0.0.4
│   │ │ │   └── delayed-stream@0.0.5
│   │ │ ├─┬ hawk@1.0.0
│   │ │ │ ├── boom@0.4.2
│   │ │ │ ├── cryptiles@0.2.2
│   │ │ │ ├── hoek@0.9.1
│   │ │ │ └── sntp@0.2.4
│   │ │ ├─┬ http-signature@0.10.0
│   │ │ │ ├── asn1@0.1.11
│   │ │ │ ├── assert-plus@0.1.2
│   │ │ │ └── ctype@0.5.2
│   │ │ ├── json-stringify-safe@5.0.0
│   │ │ ├── node-uuid@1.4.1
│   │ │ ├── oauth-sign@0.3.0
│   │ │ ├── qs@0.6.6
│   │ │ ├─┬ tough-cookie@0.12.1
│   │ │ │ └── punycode@1.2.4
│   │ │ └── tunnel-agent@0.4.0
│   │ └─┬ through2@0.4.2
│   │   ├─┬ readable-stream@1.0.27-1
│   │   │ ├── core-util-is@1.0.1
│   │   │ ├── inherits@2.0.1
│   │   │ ├── isarray@0.0.1
│   │   │ └── string_decoder@0.10.25-1
│   │   └─┬ xtend@2.1.2
│   │     └── object-keys@0.4.0
│   ├─┬ file-utils@0.1.5
│   │ ├── isbinaryfile@0.1.9
│   │ ├── lodash@2.1.0
│   │ └─┬ minimatch@0.2.14
│   │   ├── lru-cache@2.5.0
│   │   └── sigmund@1.0.0
│   ├── findup-sync@0.1.3
│   ├─┬ glob@3.2.11
│   │ ├── inherits@2.0.1
│   │ └─┬ minimatch@0.3.0
│   │   ├── lru-cache@2.5.0
│   │   └── sigmund@1.0.0
│   ├── iconv-lite@0.2.11
│   ├─┬ inquirer@0.4.1
│   │ ├─┬ cli-color@0.2.3
│   │ │ ├── es5-ext@0.9.2
│   │ │ └─┬ memoizee@0.2.6
│   │ │   ├── event-emitter@0.2.2
│   │ │   └── next-tick@0.1.0
│   │ ├── mute-stream@0.0.4
│   │ ├── readline2@0.1.0
│   │ └── through@2.3.4
│   ├── isbinaryfile@2.0.1
│   ├── lodash@2.4.1
│   ├── mime@1.2.11
│   ├── mkdirp@0.3.5
│   ├─┬ request@2.30.0
│   │ ├── aws-sign2@0.5.0
│   │ ├── forever-agent@0.5.2
│   │ ├─┬ form-data@0.1.2
│   │ │ └─┬ combined-stream@0.0.4
│   │ │   └── delayed-stream@0.0.5
│   │ ├─┬ hawk@1.0.0
│   │ │ ├── boom@0.4.2
│   │ │ ├── cryptiles@0.2.2
│   │ │ ├── hoek@0.9.1
│   │ │ └── sntp@0.2.4
│   │ ├─┬ http-signature@0.10.0
│   │ │ ├── asn1@0.1.11
│   │ │ ├── assert-plus@0.1.2
│   │ │ └── ctype@0.5.2
│   │ ├── json-stringify-safe@5.0.0
│   │ ├── node-uuid@1.4.1
│   │ ├── oauth-sign@0.3.0
│   │ ├── qs@0.6.6
│   │ ├─┬ tough-cookie@0.9.15
│   │ │ └── punycode@1.2.4
│   │ └── tunnel-agent@0.3.0
│   ├── rimraf@2.2.8
│   ├── shelljs@0.2.6
│   ├── text-table@0.2.0
│   └── underscore.string@2.3.3
├─┬ generator-angular-fullstack@1.4.2
│ ├─┬ chalk@0.4.0
│ │ ├── ansi-styles@1.0.0
│ │ ├── has-color@0.1.7
│ │ └── strip-ansi@0.1.1
│ ├─┬ wiredep@0.4.2
│ │ ├─┬ chalk@0.1.1
│ │ │ ├── ansi-styles@0.1.2
│ │ │ └── has-color@0.1.7
│ │ └── lodash@1.3.1
│ └─┬ yeoman-generator@0.16.0
│   ├── async@0.2.10
│   ├─┬ cheerio@0.13.1
│   │ ├─┬ CSSselect@0.4.1
│   │ │ ├── CSSwhat@0.4.5
│   │ │ └─┬ domutils@1.4.3
│   │ │   └── domelementtype@1.1.1
│   │ ├── entities@0.5.0
│   │ ├─┬ htmlparser2@3.4.0
│   │ │ ├── domelementtype@1.1.1
│   │ │ ├── domhandler@2.2.0
│   │ │ ├── domutils@1.3.0
│   │ │ └─┬ readable-stream@1.1.13-1
│   │ │   ├── core-util-is@1.0.1
│   │ │   ├── inherits@2.0.1
│   │ │   ├── isarray@0.0.1
│   │ │   └── string_decoder@0.10.25-1
│   │ └── underscore@1.5.2
│   ├── class-extend@0.1.1
│   ├── dargs@0.1.0
│   ├── debug@0.7.4
│   ├── diff@1.0.8
│   ├─┬ download@0.1.16
│   │ ├─┬ decompress@0.2.3
│   │ │ ├── adm-zip@0.4.4
│   │ │ ├─┬ extname@0.1.2
│   │ │ │ └── ext-list@0.1.0
│   │ │ ├─┬ map-key@0.1.1
│   │ │ │ └── mout@0.9.1
│   │ │ ├─┬ stream-combiner@0.0.4
│   │ │ │ └── duplexer@0.1.1
│   │ │ ├─┬ tar@0.1.19
│   │ │ │ ├── block-stream@0.0.7
│   │ │ │ ├─┬ fstream@0.1.25
│   │ │ │ │ └── graceful-fs@2.0.3
│   │ │ │ └── inherits@2.0.1
│   │ │ └─┬ tempfile@0.1.3
│   │ │   └── uuid@1.4.1
│   │ ├── each-async@0.1.2
│   │ ├── get-stdin@0.1.0
│   │ ├── get-urls@0.1.1
│   │ ├─┬ nopt@2.2.0
│   │ │ └── abbrev@1.0.5
│   │ ├─┬ request@2.34.0
│   │ │ ├── aws-sign2@0.5.0
│   │ │ ├── forever-agent@0.5.2
│   │ │ ├─┬ form-data@0.1.2
│   │ │ │ └─┬ combined-stream@0.0.4
│   │ │ │   └── delayed-stream@0.0.5
│   │ │ ├─┬ hawk@1.0.0
│   │ │ │ ├── boom@0.4.2
│   │ │ │ ├── cryptiles@0.2.2
│   │ │ │ ├── hoek@0.9.1
│   │ │ │ └── sntp@0.2.4
│   │ │ ├─┬ http-signature@0.10.0
│   │ │ │ ├── asn1@0.1.11
│   │ │ │ ├── assert-plus@0.1.2
│   │ │ │ └── ctype@0.5.2
│   │ │ ├── json-stringify-safe@5.0.0
│   │ │ ├── node-uuid@1.4.1
│   │ │ ├── oauth-sign@0.3.0
│   │ │ ├── qs@0.6.6
│   │ │ ├─┬ tough-cookie@0.12.1
│   │ │ │ └── punycode@1.2.4
│   │ │ └── tunnel-agent@0.3.0
│   │ └─┬ through2@0.4.1
│   │   ├─┬ readable-stream@1.0.27-1
│   │   │ ├── core-util-is@1.0.1
│   │   │ ├── inherits@2.0.1
│   │   │ ├── isarray@0.0.1
│   │   │ └── string_decoder@0.10.25-1
│   │   └─┬ xtend@2.1.2
│   │     └── object-keys@0.4.0
│   ├─┬ file-utils@0.1.5
│   │ ├── isbinaryfile@0.1.9
│   │ ├── lodash@2.1.0
│   │ └─┬ minimatch@0.2.14
│   │   ├── lru-cache@2.5.0
│   │   └── sigmund@1.0.0
│   ├── findup-sync@0.1.3
│   ├─┬ glob@3.2.9
│   │ ├── inherits@2.0.1
│   │ └─┬ minimatch@0.2.14
│   │   ├── lru-cache@2.5.0
│   │   └── sigmund@1.0.0
│   ├── iconv-lite@0.2.11
│   ├─┬ inquirer@0.4.1
│   │ ├─┬ cli-color@0.2.3
│   │ │ ├── es5-ext@0.9.2
│   │ │ └─┬ memoizee@0.2.6
│   │ │   ├── event-emitter@0.2.2
│   │ │   └── next-tick@0.1.0
│   │ ├── mute-stream@0.0.4
│   │ ├── readline2@0.1.0
│   │ └── through@2.3.4
│   ├── isbinaryfile@2.0.1
│   ├── lodash@2.4.1
│   ├── mime@1.2.11
│   ├── mkdirp@0.3.5

...

实际上无法发布所有内容-这个问题已经很长了,哈哈.

Can't actually post it all - this question has gotten very long, haha.

所以我想我可以确保所有的人都一样...但是没有人知道哪个对我遇到的问题最重要吗?

So I guess I could go through and make sure all of them are the same...but does anyone know which ones would be most important for the problem I am having?

吉普车,这很烦人!

推荐答案

几天来我一直在努力让我的网站在openshift上工作.我花了最后一两天的时间来确保我在计算机上使用的所有npm软件包版本都与openshift上使用的版本相同.同步所有版本后,需要大量的工作来重构我的代码,但最终我使它工作了.

I have been working on getting my site to work on openshift for a few days now. I spent the last day or two making sure that all of the npm package versions that I use on my computer are the same as the versions that are used on openshift. After I synced up all the versions, it was a lot of work to re-factor my code, but I eventually got it working.

我必须弄清的主要错误是,当我尝试执行PUT请求时,甚至以为我没有更改_id字段-这会给我这个错误:

The major error I had to figure out was that when I was trying to do a PUT request, even thought I wasn't changing the _id field - it would give me this error:

MongoError: Mod on _id not allowed

我最终意识到我需要创建一个具有所有相同信息的对象,只是没有_id字段才能使更新生效.

I eventually realized that I needed to create an object with all the same info, just without the _id field to get the update to work.

除此之外,花了很多时间才把它弄对-这是我工作的结果- http://hackabox-eamonbenproject.rhcloud.com/-我一直遇到的问题与我正在创建的论坛有关,因此请检查一下-它功能齐全.

Other than that, it just took a lot of tinkering to get it right - here is the result of my labor - http://hackabox-eamonbenproject.rhcloud.com/ - the problem I have been having pertains to the forum I was making, so check that out - it is fully functional.

这篇关于在Openshift上运行MEAN站点时,非常奇怪的Mongoose/MongoDB问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆