sails-permissions
sails-permissions copied to clipboard
import _ from 'lodash' how to fixed ?
node_modules/sails-permissions/api/services/ModelService.js:1 import _ from 'lodash' ^^^^^^
SyntaxError: Unexpected token import
at exports.runInThisContext (vm.js:54:16)
at Module._compile (module.js:375:25)
at Object.Module._extensions..js (module.js:406:10)
at Module.load (module.js:345:32)
at Function.Module._load (module.js:302:12)
at Module.require (module.js:355:17)
at require (internal/module.js:13:17)
at Object.
Which versions of sails, sails-auth, and sails-permissions are you using?
sails 11.3 sails-auth 1.3.1 sails-permissions 2.1.11
node v5.2.0
Everything is explained well here:
https://github.com/tjwebb/sails-permissions/issues/126#issuecomment-160094325
Try to follow all the steps patiently and correctly.
I just grappled with this issue for a couple hours only to realize that the error was caused by me trying to extend the base sails-permissions files explicitly. Unbeknownst to me, the installed sails-permissions includes a dist
folder that has transpiled the import
statements to the functional require
statements.
Unfortunately, I didn't realize there was a dist
folder generated and I was referencing the files that weren't transpiled. This caused the above error. I spent most of my time trying to track down how to use import
in node and then finally realized my real problem was referencing the wrong files!
I'm not sure if this is your problem, but it might be!
Hi @joshmatz I am also facing the same issue. And it seems like not generating any dist file. But the error message SyntaxError: Unexpected reserved word
is showing. I have searched a lot and did not get any clear clarification from anywhere.