free-google-image-search icon indicating copy to clipboard operation
free-google-image-search copied to clipboard

JavaScript Fail NodeJS App

Open harrisonhoward opened this issue 7 years ago • 6 comments

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

harrisonhoward avatar Dec 18 '17 08:12 harrisonhoward

Does your environment support es modules?

mrsimb avatar Dec 21 '17 09:12 mrsimb

same here

MuhammadHasham23 avatar Feb 10 '18 14:02 MuhammadHasham23

@Forbidden-Duck Try running node with --experimental-modules enabled

Techblogogy avatar Apr 09 '18 17:04 Techblogogy

same here, modules should not be dependent on environment.

Alino avatar Sep 16 '18 23:09 Alino

Same here. Any solution?

sidan5 avatar Jan 14 '19 17:01 sidan5

@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! 👍

SmolinPavel avatar Jan 15 '19 21:01 SmolinPavel