free-google-image-search
free-google-image-search copied to clipboard
JavaScript Fail NodeJS App
Hi, I'm working on a Discord Bot which was going to use this NPM
I received this Error `export default class GoogleImageSearch { ^^^^^^
SyntaxError: Unexpected token export`
Which is unfornate
Does your environment support es modules?
same here
@Forbidden-Duck Try running node with --experimental-modules enabled
same here, modules should not be dependent on environment.
Same here. Any solution?
@sidan5 if you go to the node_modules/free-google-image-search/index.js
you will see that it's just a class that can be copy pasted to your code.
You should also add import fetch from 'node-fetch';
as it uses fetch
.
And don't forget to update the url to be "https://www.google.com/search?source=lnms&sa=X&gbv=1&tbm=isch&q="+query
Cheers! 👍