I am learning that I am not aware of a lot of prerequisites before taking on this venture. However I hope that if I cannot get a direct answer perhaps someone may know where I should begin before this line…
https://heroiclabs.com/docs/nakama/client-libraries/javascript-client-guide/#install-and-setup
To me the statement “import it into your project to use it” doesn’t mean anything, as I am not sure what the definition of ‘project’ is.
So I’ve attempted to troubleshoot what I’m missing on my own and attempted the following.
I began by using http-server (http-server - npm) and having everything I want in the index.html
importing it as source in the html does not work, as the browser doesn’t know how to interpret the @ symbol.
So I found an article about setting up a web server with node and express on the mozilla site. so I went back to writing the same way as in the guide with import from and when I run it with
node main.js
It says that ‘import’ cannot be used outside a module. Some help sites said to add in “type”: “module”, to the package.json but this hasn’t helped for me. So, similar to how they load Express I attempted to do the following syntax
const {Client} = require ("@heroiclabs/nakama-js");
There’s not initialization errors for this first line, however when adding anything beyond the first line of the guide there are errors reported during initialisation.
with just
var client = new nakamajs.Client("defaultkey", "127.0.0.1", "7350");
It says : “ReferenceError: nakamajs is not defined”
So I realize that I am missing quite a few basics that were meant to be understood beforehand, however I am not sure where to even begin to understand how to structure a ‘project’ as it is expected in here. If there are some prerequisites that I could be guided towards I would appreciate it.