masumsoft / express-cassandra

Cassandra ORM/ODM/OGM for NodeJS with support for Apache Cassandra, ScyllaDB, Datastax Enterprise, Elassandra & JanusGraph.
http://express-cassandra.readthedocs.io
GNU Lesser General Public License v3.0
232 stars 68 forks source link

Loading models throws exception #129

Closed weeco closed 7 years ago

weeco commented 7 years ago

The cassandra express library is throwing an exception here: https://i.imgur.com/8GhR92p.png

modelsPath is:

"C:\Users\user\Documents\projectname-express\src\models-cassandra"

The exception:

Exception has occurred: SyntaxError SyntaxError: Unexpected token export at createScript (vm.js:74:10) at Object.runInThisContext (vm.js:116:10) at Module._compile (module.js:533:28) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:503:32) at tryModuleLoad (module.js:466:12) at Function.Module._load (module.js:458:3) at Module.require (module.js:513:17) at require (internal/module.js:11:18) at C:\Users\user\Documents\projectname-express\node_modules\express-cassandra\lib\expressCassandra.js:64:29 at C:\Users\user\Documents\projectname-express\node_modules\async\lib\async.js:157:13 at _each (C:\Users\user\Documents\projectname-express\node_modules\async\lib\async.js:57:9) at Object.async.each (C:\Users\user\Documents\projectname-express\node_modules\async\lib\async.js:156:9) at C:\Users\user\Documents\projectname-express\node_modules\express-cassandra\lib\expressCassandra.js:53:13 at C:\Users\user\Documents\projectname-express\node_modules\readdirp\readdirp.js:292:9 at C:\Users\user\Documents\projectname-express\node_modules\readdirp\readdirp.js:252:11 at C:\Users\user\Documents\projectname-express\node_modules\readdirp\readdirp.js:199:38 at C:\Users\user\Documents\projectname-express\node_modules\graceful-fs\polyfills.js:287:18 at FSReqWrap.oncomplete (fs.js:153:5)

I've got two files in my models-cassandra folder. One is BattleLogModel.js and the other is the map file called BattleLogModel.js.map .

The file contents of BattleLogModel.js:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
    fields: {
        name: 'text',
    },
    key: ['name'],
};
//# sourceMappingURL=BattleLogModel.js.map

What's the issue here? I managed to get it running initially, I am not sure what exactly I have changed which would cause it. Does it have issues because of the sourceMap in the folder?

weeco commented 7 years ago

Can no one help me with that exception? @masumsoft

weeco commented 7 years ago

Had to use module.exports instead of the es6 export