Hi folks,
I started this week to upgrade my web-app from 1.7.0.5 to 1.8 and now I have big trouble with a “SyntaxError”.
What I did before:
meteor update --release=1.8
meteor npm install @babel/runtime@latest --save
Checked: @babel/runtime is now included with 7.1.2.
Then I cleaned up and installed:
find . -name "node_modules" -type d -exec rm -rvf '{}' +
rm -rfv .meteor/local
meteor npm prune && meteor npm i && meteor run
meteor reset
At first start, the SyntaxError (you will read below) occurred and I thought about to divide ‘n’ conquer the problem:
Just to have a tiny test of all meteor and 3rd party stuff, I commented all of my proprietary modules, started the web-app and it now error, setup/environment/meteor-dependencies seems good. Ok, then commenting one after another meteor-package in, the SyntaxError rises up again.
When I now start my app, I get the following log-messages in the console:
I20181017-17:56:14.362(2)? info: Initialized logger:
I20181017-17:56:14.363(2)? <here is some winston-logging bla bla from a Meteor.isServer instruction in the core-app; so some parts seem to be running>
I20181017-17:56:14.363(2)?
W20181017-17:56:14.460(2)? (STDERR) /home/myuser/workspaces/meteor/myproject/myproject-core/.meteor/local/build/programs/server/packages/myproject_myproject-activity.js:617
W20181017-17:56:14.460(2)? (STDERR) import {MyCollections} from "meteor/myproject:myproject-shared";
W20181017-17:56:14.461(2)? (STDERR) ^^^^^^
W20181017-17:56:14.461(2)? (STDERR)
W20181017-17:56:14.461(2)? (STDERR) SyntaxError: Unexpected token import
W20181017-17:56:14.461(2)? (STDERR) at createScript (vm.js:80:10)
W20181017-17:56:14.461(2)? (STDERR) at Object.runInThisContext (vm.js:139:10)
W20181017-17:56:14.461(2)? (STDERR) at /home/myuser/workspaces/meteor/myproject/myproject-core/.meteor/local/build/programs/server/boot.js:393:30
W20181017-17:56:14.461(2)? (STDERR) at Array.forEach (<anonymous>)
W20181017-17:56:14.461(2)? (STDERR) at /home/myuser/workspaces/meteor/myproject/myproject-core/.meteor/local/build/programs/server/boot.js:220:19
W20181017-17:56:14.461(2)? (STDERR) at /home/myuser/workspaces/meteor/myproject/myproject-core/.meteor/local/build/programs/server/boot.js:471:5
W20181017-17:56:14.462(2)? (STDERR) at Function.run (/home/myuser/workspaces/meteor/myproject/myproject-core/.meteor/local/build/programs/server/profile.js:510:12)
W20181017-17:56:14.462(2)? (STDERR) at /home/myuser/workspaces/meteor/myproject/myproject-core/.meteor/local/build/programs/server/boot.js:470:11
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.
In this project the most stuff is in ~40 packages and the main-app is almost empty. Here are the npm-dependencies of the package.json of the core-app:
"dependencies": {
"@babel/runtime": "^7.1.2",
"bcrypt": "^3.0.1",
"simpl-schema": "^1.5.3",
"winston": "^2.4.4",
<spared out some client-libs>
},
"devDependencies": {
"chai": "4.1.2"
},
Here I already excluded all of my ~20 eslint-packages, which grabbed old versions on babel and so I only see the current and non-beta version of babel in package-lock.json
I double checked the correctness of all packages:
- api.versionsFrom(“1.8”); // yes, all packages use this
- “ecmascript” // yes, without version, all packages use this
myproject-shared has all my mongo-collections (in MyCollections). The package.js has these parts:
Npm.depends({
moment: "2.22.2",
});
Package.onUse((api) => {
api.versionsFrom("1.8");
api.use([
"clinical:winston-browser-logging@0.2.3",
"ecmascript",
"erasaur:meteor-lodash@4.0.0",
"infinitedg:winston@0.7.3",
"iron:router@1.1.2",
]);
api.mainModule("myproject-shared.js", ["client", "server"]);
});
myproject-activity is also a very tiny package. In the above error it shows that it imports MyCollections (what is correct).
Package.onUse((api) => {
api.versionsFrom("1.8");
api.use([
"ecmascript",
"erasaur:meteor-lodash@4.0.0",
"myproject:myproject-basic-schema@0.0.1",
"myproject:myproject-shared@0.0.1",
"myproject:myproject-user@0.0.1",
"myproject:tabular@2.2.3",
], ["client", "server"]);
api.use([
"blaze-html-templates", // meta-package with blaze, spacebars, templating, ...
"myproject:myproject-styles@0.0.1",
"iron:router@1.1.2",
"jquery",
"less",
"reactive-var",
], 'client');
api.mainModule('client.js', 'client');
api.mainModule('server.js', 'server');
});
Currently I can reproduce the problem by including/excluding exactly one of all meteor-packages (named here “myproject:myproject-activity”): when I include it, I get the “SyntaxError” occures. If I exclude it, the server starts clearly.
I reduced this package, so no npm-dependencies and only meteor-packages loaded, which are already loaded as dependencies of other packages (checked in the profiling, see below).
I compared now the two starts with this package and without with that command:
METEOR_PROFILE=0 METEOR_LOG=debug MONGO_URL=mongodb://localhost:27017/myproject meteor run --settings ./settings-local.json --verbose
To compare it easily, I piped the two starts (with and without the package) into two files (removed the line endings with the x ms start duration) and got two very similar logs, showing some loading of my packages in a different order. But the order / loading of ecmascript or other ES2015 related packges is similiar.
meteor list --tree
shows two completely equal trees, only difference is this additional block:
myproject:myproject-activity@0.0.1
├── blaze-html-templates@1.1.2 (top level)
├── myproject:myproject-basic-schema@0.0.1 (top level)
├── myproject:myproject-shared@0.0.1 (top level)
├── myproject:myproject-styles@0.0.1 (top level)
├── myproject:myproject-user@0.0.1 (top level)
├── ecmascript@0.12.1 (top level)
├── erasaur:meteor-lodash@4.0.0
├── iron:router@1.1.2 (top level)
└── reactive-var@1.0.11 (top level)
I also dropped my .meteor/versions file, as this helped me already many times in the past on meteor update problems, but without any luck.
Any help appreciated, currently I am stuck. Thx in advance.