Issue migrating dev and prod to new os (RESOLVED)

Over the years I have developed several Meteor apps on a dev box, and then deploy them onto a production box. They are currently at Meteor 2.7.3.

Since the underlying OSs in my dev and prod boxes were now sorrily out of date, i decided to migrate to new boxes of a more modern version - ubuntu 22.04.

I setup a new production box using Ubuntu 22.04, and NPM installed my most recent dev tar bundles onto the new box. They all work fine.

I then setup a new dev box using Ubuntu 22.04, and copied my meteor source folders onto that new box. So far so good, or so I thought…

I noticed this week that if run an unmodified dev version app on the dev box the app runs fine there, but if I then do a new ‘build deploy’ for the new prod box, the new bundle fails during NPM install on my new production box, despite my source code being unchanged.

my tar bundles from before the move can be installed on my new production machine, but newly built tar budles using the same source code cannot be installed on the new production machine.

This is the error message I now get when npm install a newly built tar bundle…

> bcrypt@3.0.8 install /var/www/ff/redo/bundle/programs/server/npm/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module '../'
Require stack:
- /var/www/ff/redo/bundle/programs/server/npm/node_modules/.bin/node-pre-gyp
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object.<anonymous> (/var/www/ff/redo/bundle/programs/server/npm/node_modules/.bin/node-pre-gyp:15:20)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/www/ff/redo/bundle/programs/server/npm/node_modules/.bin/node-pre-gyp'
  ]
}
npm ERR! code ELIFECYCLE

The tar bundle now produced from meteor build deploy seems to be missing several folders compared what was part of my older tar bundle, especially items related to meteor packages I use. I would expect the tars to be nearly identical.

here is a partial sample of a diff between the two bundles:

Only in ../bundle/programs/server/npm/node_modules/meteor/iron_router/node_modules/body-parser/node_modules/type-is: .meteor-portable-1.json
Only in ../bundle/programs/server/npm/node_modules/meteor/iron_router/node_modules/body-parser/node_modules/type-is/node_modules/media-typer: .meteor-portable-1.json
Only in ../bundle/programs/server/npm/node_modules/meteor/iron_router/node_modules/body-parser/node_modules/type-is/node_modules/mime-types: .meteor-portable-1.json
Only in ../bundle/programs/server/npm/node_modules/meteor/iron_router/node_modules/body-parser/node_modules/type-is/node_modules/mime-types/node_modules/mime-db: .meteor-portable-1.json
Only in bundle/programs/server/npm/node_modules/meteor/iron_router/node_modules: grunt
Only in bundle/programs/server/npm/node_modules/meteor/iron_router/node_modules: grunt-markdown
Only in ../bundle/programs/server/npm/node_modules/meteor/patte_mime-npm/node_modules/mime: .meteor-portable
Only in ../bundle/programs/server/npm/node_modules/meteor/patte_mime-npm/node_modules/mime: .meteor-portable-1.json
Only in ../bundle/programs/server/npm/node_modules/meteor/patte_mime-npm/node_modules/mime/types: .meteor-portable
Only in ../bundle/programs/server/npm/node_modules/meteor/sacha_spin/node_modules/spin.js/bower_components: .meteor-portable
Only in ../bundle/programs/server/npm/node_modules/meteor/sacha_spin/node_modules/spin.js/.grunt: .meteor-portable
Only in ../bundle/programs/server/npm/node_modules/meteor/sacha_spin/node_modules/spin.js: .meteor-portable
Only in ../bundle/programs/server/npm/node_modules/meteor/sacha_spin/node_modules/spin.js: .meteor-portable-1.json
Only in ../bundle/programs/server/npm/node_modules/meteor/url/node_modules: .core-js-garbage-1hh5y1d.4qsj
Only in ../bundle/programs/server/npm/node_modules/meteor/url/node_modules: .core-js-garbage-1lxrcem.a1zi
Only in bundle/programs/server/npm/node_modules/meteor/url/node_modules: .core-js-garbage-ahylcl.br2if
Only in ../bundle/programs/server/npm/node_modules/meteor/url/node_modules: .core-js-garbage-dh4yqs.uxhsf
Only in ../bundle/programs/server/npm/node_modules/meteor/url/node_modules: .core-js-garbage-swib74.0l6i
Only in ../bundle/programs/server/npm/node_modules/meteor/url/node_modules: .core-js-garbage-szmvw8.yvzkq
Only in ../bundle/programs/server/npm/node_modules/meteor/url/node_modules: .core-js-garbage-y9htwk.qxqb
Only in ../bundle/programs/server/npm/node_modules/meteor/url/node_modules: .temp-a87ael.eqtib
Only in ../bundle/programs/server/npm/node_modules/meteor/vsivsi_file-collection/node_modules/async/dist: .meteor-portable
Only in ../bundle/programs/server/npm/node_modules/meteor/vsivsi_file-collection/node_modules/async/lib: .meteor-portable
Only in ../bundle/programs/server/npm/node_modules/meteor/vsivsi_file-collection/node_modules/async: .meteor-portable-1.json
Only in ../bundle/programs/server/npm/node_modules/meteor/vsivsi_file-collection/node_modules/cookie-parser: .meteor-portable-1.json

etc 

Any ideas what i may be missing on my dev machine?

Maybe a simpler question is:

What is the proper way to move a meteor dev environment and its files from one box to another?

Commit your code to a code repository like github and pull it down on another machine (that has Meteor installed) and … npm i for dependencies.
If you need the data in the local DB, just copy the DB folder and overwrite the DB folder in the new Meteor installation

aha. I’ll give it a try. I had only moved the folders then did npm -i. I’ll let you know how it goes.

Your input got me thinking. It seems the problem is that node_modules (that I had copied over to the new dev machine) were incorrect. I removed the node_modules, did an npm install, meteor build deploy, and it worked.

Thanks so much for everyone’s help