You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, my node modules have been reset for somewhat reason(idk) and I re-installed it. It worked properly until yesterday, but this error suddenly occurred.
+) I'm using ExpressJS
Error Message
TypeError: PythonShell.run is not a function
at getKeyword (/home/joon/Desktop/server_study/db.js:313:17)
I Looked it up and apparently it's not that simple. Imports are a es6 feature so I thought they would work in node, given that even the outdated node 6.14.4 supports the vast majority of es6 features. But apparently only the latest edition of node supports imports.
Activity
Almenon commentedon Sep 6, 2018
Almenon commentedon Sep 6, 2018
I Looked it up and apparently it's not that simple. Imports are a es6 feature so I thought they would work in node, given that even the outdated node 6.14.4 supports the vast majority of es6 features. But apparently only the latest edition of node supports imports.
See https://stackoverflow.com/questions/45854169/how-can-i-use-an-es6-import-in-node
So if you want to use imports you have four options:
Or you can use require, like so:
Repl.it Example
sni-J commentedon Sep 6, 2018
Thanks for your help!
Almenon commentedon Sep 15, 2018
@sni-J I found out you can still use require - see updated comment above.