trailsjs / sails-permissions

Comprehensive user permissions and entitlements system for sails.js and Waterline. Supports user authentication with passport.js, role-based permissioning, object ownership, and row-level security.
MIT License
418 stars 113 forks source link

Unexpected reserved word - import #186

Open NikkiDreams opened 8 years ago

NikkiDreams commented 8 years ago

I just did a fresh install in my Sails project. Starting server results in this error. I'm not sure how much E6 support is in Sails right now if any. Our apps are full E6 compliant or nearly so. I have tried several options using a transpiler. But have not gotten past this one yet.

verbose: Loading app services...
/www/5m/rest-api/node_modules/sails-permissions/api/services/ModelService.js:1
(function (exports, require, module, __filename, __dirname) { import _ from 'l
                                                              ^^^^^^
SyntaxError: Unexpected reserved word
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/www/5m/rest-api/api/services/ModelService.js:4:14)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at /www/5m/rest-api/node_modules/include-all/index.js:129:29
    at Array.forEach (native)

My project dependencies include: Node 0.12.7 "babel-core": "^6.1.2", "bcrypt": "^0.8.5", "ejs": "^2.3.4", "lodash": "^3.10.1", "passport": "^0.3.0", "passport-jwt": "^1.2.1", "passport-local": "^1.0.0", "pluralize": "^1.2.1", "sails": "^0.12.0-rc3", "sails-auth": "^2.1.1", "sails-permissions": "^2.1.8",

michaek commented 8 years ago

I'm getting the same error, and it seems to be resulting mostly from https://github.com/tjwebb/sails-permissions/commit/696b56418442efa0a751c71af5f8f0b8fda3f910, though there do seem to be a couple other ES2105 style imports. It seems it might be a good idea to use the old node-style require() syntax for the time being?

akurtz commented 8 years ago

+1

RoM4iK commented 8 years ago

add to .babelrc following strings

{
  "presets": ["es2015"]
}
joshmatz commented 8 years ago

I ran into this issue and guessing it's related. Here's my explanation: https://github.com/tjwebb/sails-permissions/issues/198#issuecomment-177629496