nilsi
nilsi

Reputation: 10761

Meteor 1.3 NPM: Unexpected reserved word import

I'm trying to follow the guide here:

https://guide.meteor.com/using-packages.html

Installing a few node packages then trying to import them into my methods.js file but Im getting the following error:

W20160423-15:08:57.338(9)? (STDERR) app/server/methods.js:1
W20160423-15:08:57.338(9)? (STDERR) (function(Npm,Assets){(function(){import Fibers from 'fibers';
W20160423-15:08:57.338(9)? (STDERR)                                   ^^^^^^
W20160423-15:08:57.343(9)? (STDERR) SyntaxError: Unexpected reserved word
W20160423-15:08:57.344(9)? (STDERR)     at /repos/myproject/.meteor/local/build/programs/server/boot.js:278:30
W20160423-15:08:57.344(9)? (STDERR)     at Array.forEach (native)
W20160423-15:08:57.344(9)? (STDERR)     at Function._.each._.forEach (/Volumes/320gb/macbookpro/.meteor/packages/meteor-tool/.1.3.2_4.1rz3z4t++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20160423-15:08:57.345(9)? (STDERR)     at /repos/myproject/.meteor/local/build/programs/server/boot.js:133:5

My packages seems to be installed correctly. Not sure what's causing this, Is this a bug?

Upvotes: 9

Views: 3289

Answers (2)

Ian Serlin
Ian Serlin

Reputation: 1

If you've already added the ecmascript package another issue that can trigger this kind of error output is incorrect usage of ES6+ features.

For example, redeclaring a variable within the same scope or trying to re-assign to a variable declared with const.

It's a horrible error output, but it basically means the transpiler can't parse the file and create an AST properly.

Upvotes: 0

Kishor
Kishor

Reputation: 2677

This error occurs if you don't add ecmascript packages. I think (not sure), this is added by default for newer projects but needs to be added explicitly when updating from previous versions of meteor. Try adding this package using,

meteor add ecmascript

Last time, I also faced similar problem, I came to know about it from this link.

Upvotes: 18

Related Questions