My is my 1.2 app throwing errors like it's ecma 2015+?

I have an app that I wrote back on Meteor 1.2 using several plugins, including aldeed:autoform. It was working just fine, and was even deployed. Now I needed to go update some things, starting with updating the latest mup to support custom Docker images, and now nothing works. It’s as if the app is trying to use the ecmascript plugin, even though I haven’t included it in my project at all. All over the place, I am getting errors saying that things that used to be in global scope are no longer being found. For instance, I was getting errors in the client about not being able to find functions I defined globally using var myFunc = function() {...}, not finding the collections I defined in the window, etc. Some of these I have attempted to correct, like the window one I just manually add them using something like if (Meteor.isClient) { window.MyCollection = MyCollection; }.

Now my Meteor methods are failing because they can’t find the collections. I don’t know what to do. I really don’t want to have to refactor this whole app to be 1.3 yet.

I should note that I have other projects that are Meteor 1.3.x (latest), just not this one.

1 Like

It’s possible that the newer versions of some packages were published using Meteor 1.3, and are effectively not compatible with 1.2 apps. When a package starts using 1.3 features, it should really bump its minor version (the y in x.y.z), and any updates for 1.2 apps should happen on the older minor version, using meteor publish --release 1.2.1.

Have you tried updating anything other than mup? If you need to pin down the version of a specific package, you can put (for example) mup@=x.y.z in your .meteor/packages file, so that only the exact x.y.z version can be used.

As always, if you can’t get to the bottom of this, and you’re comfortable sharing some sort of reproduction, I’d be happy to take a look at it.

Sorry for this annoyance!

I have gone through .meteor/packages and specified each version using my old commited .meteor/version to get the version of the working app then removed the .meteor/local folder to make sure nothing was lingering. I then restarted the app locally compared the old .meteor/versions to the newly generated one, and they are identical. But I am still getting the error.

The only thing “upgraded” at this point is node itself (using v5.7.1, pulled from brew) and mup, using the latest from here. I seriously don’t think it’s mup, as it’s an external build tool. Maybe the node update is causing some issues?

Here are the logs I am getting:

W20160522-10:30:31.918(-4)? (STDERR)
W20160522-10:30:31.921(-4)? (STDERR) /Users/XXX/.meteor/packages/meteor-tool/.1.1.10.j0nmqv++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20160522-10:30:31.921(-4)? (STDERR) 						throw(ex);
W20160522-10:30:31.921(-4)? (STDERR) 						      ^
W20160522-10:30:31.922(-4)? (STDERR) ReferenceError: Attachments is not defined
=> Exited with code: 8

Attachments is defined in /both/collections/attachments.js as such:

var Attachments = new FS.Collection('attachments', {
	stores: [
		new FS.Store.FileSystem('attachments', {
			path: '~/assignments_app/attachments',
			filter: {
				maxSize: 10485760,
				allow: {
					contentTypes: 
						['image/*', 'application/pdf', 'application/msword', 
						'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
					extensions: ['png', 'jpg', 'gif', 'doc', 'docx', 'pdf']
				},
				deny: {
					contentTypes: 
						['application/x-msdownload'],
					extensions: ['exe', 'bat']
				}
			}
		}),
		new FS.Store.FileSystem('thumbs', {
			path: '~/assignments_app/thumbs',
			beforeWrite: function(fileObj) {
				// We return an object, which will change the
				// filename extension and type for this store only.
				return {
					extension: 'png',
					type: 'image/png'
				};
			},
			transformWrite: function(fileObj, readStream, writeStream) {
				// Transform the image into a 10x10px PNG thumbnail
				gm(readStream).resize(60).stream('PNG').pipe(writeStream);
				// The new file size will be automatically detected and set for this store
			}
		}),
		new FS.Store.FileSystem('preview', {
			path: '~/assignments_app/preview',
			beforeWrite: function(fileObj) {
				// We return an object, which will change the
				// filename extension and type for this store only.
				return {
					extension: 'png',
					type: 'image/png'
				};
			},
			transformWrite: function(fileObj, readStream, writeStream) {
				// Transform the image into a 300x300px PNG thumbnail
				gm(readStream).resize('600','600').stream('PNG').pipe(writeStream);
				// The new file size will be automatically detected and set for this store
			}
		})]
});

At this time, Meteor will only work with 0.10.xx - I believe 0.10.43 is the current version.

Yes, but doesn’t Meteor use it’s own internal version of Node? At least, that was my understanding.

Only in dev (via the meteor command). To deploy, you need to provide the correct version.

Right. The issue I am having is in Dev, on my local laptop.