SyntaxError: Unexpected token =


#1

Meteor version: 1.5.1
Installed version of node on the machine: 8.14.0

For some reason, after few days off, I’ve tried to rerun my project and I’ve got this error

W20190127-19:11:52.020(-2)? (STDERR) packages/modules.js:18926
W20190127-19:11:52.096(-2)? (STDERR) function padStart(input, n = 2) {
W20190127-19:11:52.098(-2)? (STDERR)                            ^
W20190127-19:11:52.099(-2)? (STDERR)
W20190127-19:11:52.101(-2)? (STDERR) SyntaxError: Unexpected token =
W20190127-19:11:52.105(-2)? (STDERR)     at Object.exports.runInThisContext (vm.js:53:16)
W20190127-19:11:52.109(-2)? (STDERR)     at /src/.meteor/local/build/programs/server/boot.js:331:30
W20190127-19:11:52.111(-2)? (STDERR)     at Array.forEach (native)
W20190127-19:11:52.113(-2)? (STDERR)     at Function._.each._.forEach (/.meteor/packages/meteor-tool/.1.5.1.awa4uj.8dwxb++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20190127-19:11:52.113(-2)? (STDERR)     at /src/.meteor/local/build/programs/server/boot.js:158:5
W20190127-19:11:52.114(-2)? (STDERR)     at /src/.meteor/local/build/programs/server/boot.js:387:5
W20190127-19:11:52.114(-2)? (STDERR)     at Function.run (/src/.meteor/local/build/programs/server/profile.js:510:12)
W20190127-19:11:52.115(-2)? (STDERR)     at /src/.meteor/local/build/programs/server/boot.js:386:11

I’ve tried a lot of approaches but without success. I’ve even reinstalled meteor.


#2

At first sight that error suggests a missing ecmascript package. However, Meteor 1.5.1 uses Node 4.8.4. It may be worth trying that version, since Node 8 is not necessarily going to work.


#3

The update to meteor 1.8.1 solved the problem.

I was aware of this kind of error would be caused by the missing of the ecmascript package. However, even its manually addition (“meteor add ecmascript”) wasn’t enough to solve the problem.

Thank you for the answer @robfallows.