question

mdiminsky avatar image
mdiminsky asked

Cannot find module 'playfab-sdk/PlayFab'

Hi there,

I've got a server running on express and everything works fine. I've installed the node-sdk and literally copied and pasted this code(https://api.playfab.com/docs/getting-started/node-getting-started) yet I get this error when I run the file `Cannot find module 'playfab-sdk/PlayFab'`. I thought maybe somehow it was installed badly. I've install via `npm` and then another time with `yarn` yet still no luck--I keep getting this error. I've tried looking through the forums but didn't find a question for this.

Any advice would be appreciated at this point, thank you!

sdksCustom Game Servers
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Could you review all the steps in our Node getting started guide? In specific, that error means that Node is looking in the local context for the playfab-sdk dependency and not finding it. But that should have been installed with the "npm install playfab-sdk" step.

If it helps, one of our customers posted a repo of his own project, which also uses express.js: https://github.com/dylanh724/tol-node-public.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mdiminsky avatar image mdiminsky commented ·

Thank you @Brendan That is actually really helpful. He didn't install the playfab-sdk but instead used the files provided in the node install. These are the same ones found under node_modules if he would have actually installed it. I like his approach and will try it out since when installing it via npm doesnt seem to find it. Will update you tomorrow, thanks! ^_^

0 Likes 0 ·
1807605288 avatar image
1807605288 answered

I've become aware that we missed a step when setting up our Node npm package, which means you can't import our package like normal lpackages. We're working on the issue, and hope to have a fix soon.

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1807605288 avatar image 1807605288 ♦ commented ·

For now, you can import the files directly, via folder paths. This is less optimal than the normal NPM pattern, but it will work until we have a fix.

0 Likes 0 ·
Fernando Rojas avatar image Fernando Rojas commented ·

Hi Guys,

I'm receiving the same message bu installing with the "npm install playfab-sdk" step. Is there any news on this issue?

0 Likes 0 ·
1807605288 avatar image 1807605288 ♦ Fernando Rojas commented ·

We are still in progress on the Node package update. We've tested the basic fixes, but we haven't yet gotten it working with our automated build system.

However, I just tested "npm install playfab-sdk", and the installation completed successfully. Your require statements will need to use the full relative path to the actual .js files until we fix the module, but installation should complete successfully.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.