[RFE] - provide build/run instructions
Closed this issue ยท 5 comments
Hello,
This server looks really cool! Could you please provide instructions on how to build and run it. I couldn't find build/run scripts definitions in package.json file.
EDIT
I tried starting it in a docker container it failed
node@64a2ddc81071:/data$ node -r ts-node/register $(pwd)/index.ts
/data/node_modules/ts-node/dist/index.js:729
return old(m, filename);
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /data/node_modules/node-fetch/src/index.js from /data/util/fetch.ts not supported.
Instead change the require of index.js in /data/util/fetch.ts to a dynamic import() which is available in all CommonJS modules.
at Object.require.extensions.<computed> [as .js] (/data/node_modules/ts-node/dist/index.js:729:20)
at Object.<anonymous> (/data/util/fetch.ts:3:15)
at Module.m._compile (/data/node_modules/ts-node/dist/index.js:735:29)
at Object.require.extensions.<computed> [as .ts] (/data/node_modules/ts-node/dist/index.js:737:16)
at Object.<anonymous> (/data/index.ts:19:1)
at Module.m._compile (/data/node_modules/ts-node/dist/index.js:735:29)
at Object.require.extensions.<computed> [as .ts] (/data/node_modules/ts-node/dist/index.js:737:16) {
code: 'ERR_REQUIRE_ESM'
}
๐คi think your error may be originating from different node versions -especially considering the node-detch package whihc recently changed their import style
did you include the tsconfig.json in the root path ? i did change a few things in there
personally im using https://github.com/jonnytest1/docker-images-rpi/tree/main/node this node image (though even that may be locally cached and have an older version )
when i run it on my local windows machien i get the same error ๐ but it works on my raspberrypi
i'll see what i can do (but i cant promise anything since changing module imports usually breaks everything)
i think your error may be originating from different node versions
Which version do you use?
did you include the tsconfig.json in the root path ? i did change a few things in there
I don't know what you mean. Here's what I did:
$ git clone https://github.com/jonnytest1/workadventure-mapserver
$ cd workadventure-mapserver
$ docker run -it --rm -v $(pwd):/data -u $(id -u):$(id -u) -p 3000:3000 node bash
then
node@64a2ddc81071:/data$ node -r ts-node/register $(pwd)/index.ts
alright i reverted node-fetch bac kto version 2
(as recommended by the https://github.com/node-fetch/node-fetch/blob/HEAD/docs/v3-UPGRADE-GUIDE.md upgrade guide - it will still receive updates)
after this you can just run it with
node -r ts-node/register index.ts
for most features you will also need a mariadb database
defined by environment variables:
DB_URL=
DB_PORT=
DB_USER=
DB_PASSWORD=
DB_NAME=
just creating it should be enough i'm using this https://github.com/jonnytest1/hibernateTS to do all the database stuffs (if u plan to do changes is recommend reading the readme for that or u might introduce sql injections ๐ )
added a setup readme https://github.com/jonnytest1/workadventure-mapserver/blob/master/Readme.setup.md
Many thanks for the quick reply! I could get it to start after tuning the docker-compose file!
Closing the issue.
The WorkAdventure API URL is hard coded in this file, could be passed as parameter.