[SOLVED] Cloned app produces errors

I have a working application (development environment). Before pushing it to production, I decided to verify it. I did the following

  1. Cloned the git source code (‘app1’) to another directory (‘app2’): “git clone dir1 dir2”
  2. Installed the dependencies “cd dir2 && meteor npm install”
  3. Ran it: “meteor --settings=settings.json”

I was expecting a smooth execution (with the empty db, of course), but instead I got:

While processing files with ecmascript (for target web.browser):
native: Converting circular structure to JSON
at Object.stringify (native)

I have no idea what is happening. I have a working application in “app1” and a a broken in “app2” while both have the same code: all files are identical, the same “packages” and “versions” files, the same output from “meteor list”

Apparently, the file “app2/.meteor/local/build/programs/web.browser/app/app.js” is not generated correctly (1kB versus 600kB in app1’). But I don’t understand why… And I am not sure is it the symptom or the cause of the problem. Any clues?

Thanks a lot in advance!

Always best to Meteor create app2.

Let Meteor build all the file paths and dependencies for you. You CANNOT copy and paste like this.

So, once you create the new app3 folder in this case, copy paste your .meteor/packages ONLY

Also take /node_modules

Should start right up for you.

Try deleting .meteor/local/ to clean out any old build files, that often fixes things.
(You can keep .meteor/local/db/ though if you don’t want to repopulate your database).

This method works for me (as it should - Meteor has always supported cloning with git).

So I wonder if you have something in your repo (app1) which shouldn’t be there?

Basically, when you create a Meteor application you get a .gitignore in your application root (which just contains node_modules) and another .gitignore in meteor/ (which just contains local).

Your git repo should therefore not contain node_modules/ or .meteor/local/ - everything else should be there - except that you may choose to .gitignore files containing private data. However, .meteor/ should be part of the repo, but excluding local/.

Use git ls-tree HEAD or git ls-tree --r HEAD for a synopsis of what’s included in the repo.

I wonder - did you do a git add .meteor .gitignore in your app1 repo before committing and cloning?

The file .gitignore only contains 'node_modules/'
The file .meteor/.gitignore only contains 'local’
After cloning, the directory ‘local’ does not exist (of course!), there is no need to delete it.

These two statements are contradicting each other and I think I CAN copy the file structure

  1. Let Meteor build all the file paths and dependencies for you. You CANNOT copy and paste like this.

  2. This method works for me (as it should - Meteor has always supported cloning with git).

Another test: instead of “git clone” I did "cp -a app1 app3 && rm -rf app3/.meteor/local/ " etc… The resulted app3 works. So, something dirty is happening in the node_modules directory. And indeed, I have 365 files of app1/node_modules versus 240 of app2/node_modules. I will try to figure out which package will fix my problem.

But honestly, it is not nice. If meteor does not recommend to put the directory node_modules under version control, the content of it should be automatically generated by install/update/remove/start commands. This is not what I see.

When you added (runtime) node packages to app1, did you use meteor npm i packagename --save?

1 Like

Yes, I hope so. Because I am working on my first meteor application, I had lots of packages inserts and removals. Obviously, there are some leftovers from the removed packages.

Missing npm packages suggests that you may not have done this consistently - check the dependencies listed in package.json. The --save option is important for this to work as expected.

So, if I skip “–save” option, the package will be added (directory nodemodules will have new packages), but the dependency (file package.json) will not be update, right? OK, it could have happened.

Correct. You could compare what you have in node_modules with what’s declared in package.json, identify what’s missing and add them into app1’s package.json manually. Then try re-cloning. There will, of course, be automatically added dependencies in node_modules, so it’s probably not going to be a case of just adding in the differences.

1 Like

OK, the problem is understood and fixed. Many thanks!

1 Like

So can you clarify what your solution was? :slight_smile:

Most probably I did not use “–save-dev” flag while installing babel compiler (and some other components of it). By adding the following packets (this time with meteor npm install --save-dev !!!) the problem was cured:

  • “babel-cli”: “^6.24.1”,
  • “babel-plugin-transform-decorators”: “^6.24.1”,
  • “babel-plugin-transform-react-jsx”: “^6.24.1”,
  • “babel-plugin-transform-runtime”: “^6.23.0”,
  • “babel-polyfill”: “^6.23.0”,
  • “babel-preset-flow”: “^6.23.0”,
  • “babel-preset-latest”: “^6.24.1”,
  • “babel-preset-meteor”: “^6.26.0”,
  • “babel-preset-react”: “^6.24.1”,
1 Like