sails-permissions icon indicating copy to clipboard operation
sails-permissions copied to clipboard

Unexpected reserved word - import

Open NikkiDreams opened this issue 9 years ago • 4 comments

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",

NikkiDreams avatar Nov 09 '15 21:11 NikkiDreams

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?

michaek avatar Nov 17 '15 20:11 michaek

+1

akurtz avatar Nov 17 '15 23:11 akurtz

add to .babelrc following strings

{
  "presets": ["es2015"]
}

RoM4iK avatar Dec 14 '15 00:12 RoM4iK

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

joshmatz avatar Jan 31 '16 22:01 joshmatz