whatadewitt / yahoo-fantasy-sports-api

NodeJS wrapper for the Yahoo! Fantasy Sports API
https://yahoo-fantasy-node-docs.vercel.app/
MIT License
192 stars 52 forks source link

Cannot resolve module from esm #52

Closed etsweeney closed 4 years ago

etsweeney commented 4 years ago

Hello! Great app here, from the looks of it.

Installed the package, along with esm, but when I try to run I get this error: Cannot resolve module from '.\node_modules\esm'

I figured it has something to do with this line in index.js require = require("esm")(module, true);

Has anyone else run into this issue? I'm sure its something simple but I've been working on it for awhile and can't figure it out.

regs79 commented 4 years ago

Yeah I had the same exact issue yesterday and figured I was using it wrong.

I'd be interested in the reason, for now I'm just doing my own api calls.

whatadewitt commented 4 years ago

It's most likely because I need to update esm to point to 3.1+ for security reasons... I'll try to get that done today! Sorry for that!

whatadewitt commented 4 years ago

What v of node are you running?

whatadewitt commented 4 years ago

Pushed the update. Let me know if that helps.

etsweeney commented 4 years ago

Thanks for the quick fix! But I still have the same issue with the change. My node version was 8.11.3. I'm going to update to latest and give it another whirl.

whatadewitt commented 4 years ago

I'll see if I can duplicate later today!

whatadewitt commented 4 years ago

So I've been trying when I've had time over the weekend here and I'm not able to duplicate (I'm on node 8.11.2 for testing)

Is there any other error messaging you can provide?

regs79 commented 4 years ago

Just to follow up, not sure about @etsweeney, but on my end I'm pretty sure I was just using it wrong.

I was importing yfsapi via a script into my React frontend which was throwing the cannot resolve esm moduel.

When I make requests on the server side via express everything works fine.

whatadewitt commented 4 years ago

Ahhh that makes sense... Right now this only works in node... I've thought about how to get it to work with a front end lib, but I worry about the key/secret stuff...

etsweeney commented 4 years ago

Yup, that's what my situation was too. Thanks!

whatadewitt commented 4 years ago

If y'all want to try to fit it into something that can work in the front end, I would welcome that immensely!