Automattic / mongoose

MongoDB object modeling designed to work in an asynchronous environment.
https://mongoosejs.com
MIT License
26.89k stars 3.84k forks source link

Upgrading from v3.8.8 to v4.2.x #3629

Closed dolanmiu closed 8 years ago

dolanmiu commented 8 years ago

My app deploys perfectly fine when running on v3.8.8 on Heroku, but when I change it to v4.2.x, it gives me an error.

I am not sure what to do! It seems like I am stuck on 3.8.8 forever....

-----> Using set buildpack heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment

       NPM_CONFIG_LOGLEVEL=error
       NPM_CONFIG_PRODUCTION=true
       NODE_ENV=production
       NODE_MODULES_CACHE=true
-----> Installing binaries
       engines.node (package.json):  >=0.10.0
       engines.npm (package.json):   unspecified (use default)

       Resolving node version >=0.10.0 via semver.io...
       Downloading and installing node 5.0.0...
       Using default npm version: 3.3.6
-----> Restoring cache
       Loading 2 from cacheDirectories (default):
       - node_modules
       - bower_components (not cached - skipping)
-----> Building dependencies
       Pruning any extraneous modules
       Installing node modules (package.json)
       bluebird@2.9.26 node_modules/mquery/node_modules/bluebird -> node_modules/mongoose/node_modules/bluebird
       debug@2.2.0 node_modules/mquery/node_modules/debug -> node_modules/mongoose/node_modules/debug
       - hooks@0.2.1 node_modules/hooks
       - mpromise@0.4.3 node_modules/mpromise
       - mquery@1.6.1 node_modules/mquery
       - ms@0.7.1 node_modules/mquery/node_modules/ms
       - muri@1.1.0 node_modules/muri
       cs-go-mini-games@0.0.11 /tmp/build_0ed4001885273fba7499331c1720842a
       ├─┬ mongoose-models@0.0.5 (git+https://Qo9FMzL5RC1UXxwujlwfiRwc6JmzIoI7:x-oauth-basic@bitbucket.org/opcrates/mongoose-models.git#f577928242eab3c98728ee76f1762992fdca0d95)
       │ └─┬ mongoose@4.2.7
       │   ├── async@0.9.0
       │   ├── bson@0.4.19
       │   ├─┬ mongodb@2.0.49
       │   │ ├── mongodb-core@1.2.24
       │   │ └── readable-stream@1.0.31
       │   ├── mpromise@0.5.4
       │   ├── ms@0.7.1
       │   └── muri@1.0.0
       ├─┬ mongoose-paginate@4.2.0
       │ └─┬ mongoose@4.1.12
       │   ├── async@0.9.0
       │   ├── bson@0.4.19
       │   ├─┬ mongodb@2.0.46
       │   │ ├─┬ mongodb-core@1.2.19
       │   │ │ └── bson@0.4.19
       │   │ └── readable-stream@1.0.31
       │   ├── mpromise@0.5.4
       │   ├─┬ mquery@1.6.3
       │   │ └─┬ debug@2.2.0
       │   │   └── ms@0.7.1
       │   └── muri@1.0.0
       └─┬ nodemailer@1.8.0
       └─┬ needle@0.10.0
       └─┬ debug@2.2.0
       └── ms@0.7.1

       npm ERR! Linux 3.13.0-66-generic
       npm ERR! argv "/tmp/build_0ed4001885273fba7499331c1720842a/.heroku/node/bin/node" "/tmp/build_0ed4001885273fba7499331c1720842a/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_0ed4001885273fba7499331c1720842a/.npmrc"
       npm ERR! node v5.0.0
       npm ERR! npm  v3.3.6
       npm ERR! path /tmp/build_0ed4001885273fba7499331c1720842a/node_modules/mquery/node_modules/bluebird
       npm ERR! code ENOENT
       npm ERR! errno -2
       npm ERR! syscall rename

       npm ERR! enoent ENOENT: no such file or directory, rename '/tmp/build_0ed4001885273fba7499331c1720842a/node_modules/mquery/node_modules/bluebird' -> '/tmp/build_0ed4001885273fba7499331c1720842a/node_modules/mongoose/node_modules/bluebird'
       npm ERR! enoent This is most likely not a problem with npm itself
       npm ERR! enoent and is related to npm not being able to find a file.
       npm ERR! enoent

       npm ERR! Please include the following file with any support request:
       npm ERR!     /tmp/build_0ed4001885273fba7499331c1720842a/npm-debug.log
-----> Build failed

       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys

       Some possible problems:

       - Dangerous semver range (>) in engines.node
       https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

       Love,
       Heroku

 !     Push rejected, failed to compile Node.js app
vkarpov15 commented 8 years ago

Try re-running your deploy, this looks like an issue with npm not installing something correctly. Also, can you show me the output of npm list? Looks like you're using a lot of modules that depend on mongoose, may be due to something related to that.

dolanmiu commented 8 years ago

I ran my deployment multiple times, still same error. The error goes away when I revert back to v3.8.8!

Here is my npm list --depth=0 (I don't need bluebird, but I installed it in case it would fix it)

C:\Users\dolan.ADSM\Documents\GitHub\cs-go-mini-games\website>npm list --depth=0
npm WARN unmet dependency C:\Users\dolan.ADSM\Documents\GitHub\cs-go-mini-games\website\node_modules\debug requires ms@'0.7.1' but will load
npm WARN unmet dependency C:\Users\dolan.ADSM\Documents\GitHub\cs-go-mini-games\website\node_modules\ms,
npm WARN unmet dependency which is version 0.1.0
cs-go-mini-games@0.0.12 C:\Users\dolan.ADSM\Documents\GitHub\cs-go-mini-games\website
├── async@1.4.2
├── aws-sdk@2.2.4
├── bluebird@2.9.34
├── body-parser@1.5.2
├── bot-manager@0.0.0 -> C:\Users\dolan.ADSM\Documents\GitHub\opcrates-modules\bot-manager
├── bson@0.4.16
├── composable-middleware@0.3.0
├── compression@1.0.11
├── connect-livereload@0.4.1
├── connect-mongo@0.4.2
├── cookie-parser@1.0.1
├── core-util-is@1.0.1
├── cors@2.7.1
├── cron@1.0.9
├── debug@2.2.0
├── ejs@0.8.8
├── errorhandler@1.0.2
├── es6-promise@2.1.1
├── express@4.0.0
├── express-jwt@0.1.4
├── express-session@1.0.4
├── ezcrypto@0.0.3 extraneous
├── globaloffensive@0.0.6
├── grunt@0.4.5
├── grunt-angular-templates@0.5.7
├── grunt-asset-injector@0.1.0
├── grunt-autoprefixer@0.7.6
├── grunt-browserify@3.8.0
├── grunt-build-control@0.6.1
├── grunt-bump@0.6.0
├── grunt-concurrent@2.0.4
├── grunt-contrib-clean@0.6.0
├── grunt-contrib-concat@0.5.1
├── grunt-contrib-copy@0.8.2
├── grunt-contrib-cssmin@0.13.0
├── grunt-contrib-htmlmin@0.2.0
├── grunt-contrib-imagemin@0.9.4
├── grunt-contrib-jshint@0.11.3
├── grunt-contrib-sass@0.9.2
├── grunt-contrib-uglify@0.9.2
├── grunt-contrib-watch@0.6.1
├── grunt-dom-munger@3.4.0
├── grunt-env@0.4.4
├── grunt-express-server@0.4.19
├── grunt-google-cdn@0.4.3
├── grunt-google-translate@1.0.1 -> C:\Users\dolan.ADSM\Documents\GitHub\grunt-google-translate extraneous
├── grunt-karma@0.8.3
├── grunt-mocha-test@0.10.2
├── grunt-newer@0.7.0
├── grunt-ng-annotate@0.2.3
├── grunt-node-inspector@0.1.6
├── grunt-nodemon@0.2.1
├── grunt-open@0.2.3
├── grunt-protractor-runner@1.2.1
├── grunt-rev@0.1.0
├── grunt-svgmin@0.4.0
├── grunt-usemin@2.1.1
├── grunt-wiredep@2.0.0
├── hooks-fixed@1.1.0 extraneous
├── html-to-json@0.2.2
├── inherits@2.0.1
├── isarray@0.0.1
├── jit-grunt@0.9.1
├── jshint-stylish@0.1.5
├── jsonwebtoken@0.3.0
├── kareem@1.0.1 extraneous
├── karma@0.12.31
├── karma-chrome-launcher@0.1.8
├── karma-coffee-preprocessor@0.2.1
├── karma-firefox-launcher@0.1.4
├── karma-html2js-preprocessor@0.1.0
├── karma-jade-preprocessor@0.0.11
├── karma-jasmine@0.1.5
├── karma-ng-html2js-preprocessor@0.1.2
├── karma-ng-jade2js-preprocessor@0.1.5
├── karma-ng-scenario@0.1.0
├── karma-phantomjs-launcher@0.1.4
├── karma-requirejs@0.2.2
├── karma-script-launcher@0.1.0
├── kerberos@0.0.15
├── lodash@3.10.1
├── method-override@1.0.2
├── mongodb@2.0.42
├── mongodb-core@1.2.10
├── mongoose@3.8.37
├── mongoose-models@0.0.5 -> C:\Users\dolan.ADSM\Documents\GitHub\opcrates-modules\mongoose-models
├── mongoose-paginate@4.2.0
├── morgan@1.0.1
├── mpath@0.1.1
├── mpromise@0.5.4
├── mquery@1.6.3
├── ms@0.1.0 invalid
├── muri@1.0.0
├── nan@2.0.9
├── nodemailer@1.4.0
├── nodemailer-ses-transport@1.3.0
├── nodemailer-smtp-pool@1.1.1
├── open@0.0.5
├── passport@0.2.1
├── passport-local@0.1.6
├── passport-steam@0.1.5
├── process-nextick-args@1.0.3 extraneous
├── q@1.4.1
├── random-picker@0.1.0
├── readable-stream@1.0.31
├── regexp-clone@0.0.1
├── request@2.55.0
├── requirejs@2.1.17
├── rwlock@5.0.0
├── sanitize-html@1.10.0
├── serve-favicon@2.0.1
├── shelljs@0.2.6
├── should@3.3.2
├── sliced@0.0.5
├── socket.io@1.3.5
├── socket.io-client@1.3.5
├── socketio-jwt@2.3.5
├── steam@1.1.0
├── steam-api@1.1.3
├── steam-tradeoffers@2.0.2
├── steam-web@0.2.4
├── steam-web-api-key@0.0.1
├── steam-weblogon@0.0.3
├── string_decoder@0.10.31
├── supertest@0.11.0
├── thirty-two@0.0.1 extraneous
├── time-grunt@0.3.2
├── timer-stopwatch@0.1.6
├── twitter@1.2.5
└── util-deprecate@1.0.1 extraneous

npm ERR! extraneous: ezcrypto@0.0.3 C:\Users\dolan.ADSM\Documents\GitHub\cs-go-mini-games\website\node_modules\ezcrypto
npm ERR! extraneous: hooks-fixed@1.1.0 C:\Users\dolan.ADSM\Documents\GitHub\cs-go-mini-games\website\node_modules\hooks-fixed
npm ERR! extraneous: kareem@1.0.1 C:\Users\dolan.ADSM\Documents\GitHub\cs-go-mini-games\website\node_modules\kareem
npm ERR! invalid: ms@0.1.0 C:\Users\dolan.ADSM\Documents\GitHub\cs-go-mini-games\website\node_modules\ms
npm ERR! extraneous: process-nextick-args@1.0.3 C:\Users\dolan.ADSM\Documents\GitHub\cs-go-mini-games\website\node_modules\process-nextick-args
npm ERR! extraneous: thirty-two@0.0.1 C:\Users\dolan.ADSM\Documents\GitHub\cs-go-mini-games\website\node_modules\thirty-two
npm ERR! extraneous: util-deprecate@1.0.1 C:\Users\dolan.ADSM\Documents\GitHub\cs-go-mini-games\website\node_modules\util-deprecate
npm ERR! extraneous: grunt-google-translate@1.0.1 C:\Users\dolan.ADSM\Documents\GitHub\cs-go-mini-games\website\node_modules\grunt-google-translate

here is my package.json:

{
  "name": "cs-go-mini-games",
  "version": "0.0.12",
  "main": "server/app.js",
  "dependencies": {
    "aws-sdk": "^2.2.4",
    "body-parser": "~1.5.0",
    "bot-manager": "git+https://[O-AUTH-KEY]:x-oauth-basic@bitbucket.org/opcrates/bot-manager.git",
    "composable-middleware": "^0.3.0",
    "compression": "~1.0.1",
    "connect-mongo": "^0.4.1",
    "cookie-parser": "~1.0.1",
    "cors": "^2.7.1",
    "cron": "^1.0.9",
    "ejs": "~0.8.4",
    "errorhandler": "~1.0.0",
    "express": "~4.0.0",
    "express-jwt": "^0.1.3",
    "express-session": "~1.0.2",
    "globaloffensive": "0.0.6",
    "html-to-json": "^0.2.2",
    "jsonwebtoken": "^0.3.0",
    "lodash": "^3.10.1",
    "method-override": "~1.0.0",
    "mongoose": "~3.8.8",
    "mongoose-models": "git+https://[O-AUTH-KEY]:x-oauth-basic@bitbucket.org/opcrates/mongoose-models.git#master",
    "mongoose-paginate": "^4.2.0",
    "morgan": "~1.0.0",
    "nodemailer": "^1.4.0",
    "nodemailer-ses-transport": "^1.3.0",
    "nodemailer-smtp-pool": "^1.1.1",
    "passport": "~0.2.0",
    "passport-local": "~0.1.6",
    "passport-steam": "^0.1.5",
    "q": "^1.4.1",
    "random-picker": "^0.1.0",
    "request": "^2.55.0",
    "rwlock": "^5.0.0",
    "sanitize-html": "^1.10.0",
    "serve-favicon": "~2.0.1",
    "socket.io": "^1.0.6",
    "socket.io-client": "^1.0.6",
    "socketio-jwt": "^2.0.2",
    "steam": "^1.0.0",
    "steam-api": "^1.1.3",
    "steam-tradeoffers": "^2.0.2",
    "steam-web": "^0.2.4",
    "steam-web-api-key": "0.0.1",
    "steam-weblogon": "0.0.3",
    "timer-stopwatch": "^0.1.6",
    "twitter": "^1.2.5"
  },
  "devDependencies": {
    "connect-livereload": "~0.4.0",
    "grunt": "~0.4.5",
    "grunt-angular-templates": "^0.5.4",
    "grunt-asset-injector": "^0.1.0",
    "grunt-autoprefixer": "~0.7.2",
    "grunt-browserify": "^3.8.0",
    "grunt-build-control": "^0.6.0",
    "grunt-bump": "^0.6.0",
    "grunt-concurrent": "^2.0.1",
    "grunt-contrib-clean": "^0.6.0",
    "grunt-contrib-concat": "^0.5.1",
    "grunt-contrib-copy": "^0.8.0",
    "grunt-contrib-cssmin": "^0.13.0",
    "grunt-contrib-htmlmin": "~0.2.0",
    "grunt-contrib-imagemin": "^0.9.4",
    "grunt-contrib-jshint": "~0.11.2",
    "grunt-contrib-sass": "^0.9.0",
    "grunt-contrib-uglify": "^0.9.1",
    "grunt-contrib-watch": "~0.6.1",
    "grunt-dom-munger": "^3.4.0",
    "grunt-env": "~0.4.1",
    "grunt-express-server": "~0.4.17",
    "grunt-google-cdn": "~0.4.0",
    "grunt-karma": "~0.8.2",
    "grunt-mocha-test": "~0.10.2",
    "grunt-newer": "~0.7.0",
    "grunt-ng-annotate": "^0.2.3",
    "grunt-node-inspector": "~0.1.5",
    "grunt-nodemon": "~0.2.0",
    "grunt-open": "~0.2.3",
    "grunt-protractor-runner": "^1.1.0",
    "grunt-rev": "~0.1.0",
    "grunt-svgmin": "~0.4.0",
    "grunt-usemin": "~2.1.1",
    "grunt-wiredep": "^2.0.0",
    "jit-grunt": "^0.9.1",
    "jshint-stylish": "~0.1.5",
    "karma": "~0.12.9",
    "karma-chrome-launcher": "~0.1.3",
    "karma-coffee-preprocessor": "~0.2.1",
    "karma-firefox-launcher": "~0.1.3",
    "karma-html2js-preprocessor": "~0.1.0",
    "karma-jade-preprocessor": "0.0.11",
    "karma-jasmine": "~0.1.5",
    "karma-ng-html2js-preprocessor": "~0.1.0",
    "karma-ng-jade2js-preprocessor": "^0.1.2",
    "karma-ng-scenario": "~0.1.0",
    "karma-phantomjs-launcher": "~0.1.4",
    "karma-requirejs": "~0.2.1",
    "karma-script-launcher": "~0.1.0",
    "open": "~0.0.4",
    "requirejs": "~2.1.11",
    "should": "~3.3.1",
    "supertest": "~0.11.0",
    "time-grunt": "~0.3.1"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "start": "node server/app.js",
    "test": "grunt test",
    "update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update"
  },
  "private": true
}
vkarpov15 commented 8 years ago

Looks like this is a bug in npm, they're working on it. Try disabling the node modules cache as suggested in this comment: https://github.com/npm/npm/issues/9633#issuecomment-158462262

dolanmiu commented 8 years ago

Wow that actually worked! Thank you. It was puzzling me for some time.

I hope they fix this bug

vkarpov15 commented 8 years ago

For future reference, rm -rf node_modules && npm cache clean && npm install is often the best way to get npm to stop throwing a tantrum in my experience.