ERROR: Cannot find module - customLogic is not being found but it is in the lib (Solved)

0_1660360659316_ColyseusError1.png

I have deployed to the server on arena, my WebGl game can connect to the server and starts to initialize the game, but in order to start the game, it has to fetch the custom logic in another folder labeled custom logic. My localhost tests worked but for some reason it doesn't work here.

I have a feeling it is about the relative and absolute paths as the documentation mentioned something about it but I don't know where to start or what to change to fix this. I have restarted and re-uploaded the lib folder. Please help! I don't wanna wreck my code to fix this. It seems like I'm just missing some small thing as per usual.

I am using Colyseus 0.14.18 and Node 16.15.

Thank you for getting back to me! These are my dependencies for server code:

"devDependencies": {
"@colyseus/loadtest": "^0.14.4",
"@colyseus/testing": "^0.14.21",
"@types/cors": "^2.8.6",
"@types/express": "^4.17.1",
"@types/mocha": "^8.2.3",
"copyfiles": "^2.4.1",
"mocha": "^9.0.2",
"rimraf": "^2.7.1",
"ts-node": "^8.1.0",
"ts-node-dev": "^1.0.0-pre.63",
"typescript": "^3.4.5"
},
"dependencies": {
"@colyseus/arena": "^0.14.22",
"@colyseus/monitor": "^0.14.20",
"colyseus": "^0.14.20",
"cors": "^2.8.5",
"express": "^4.16.4",
"winston": "^3.3.3"
}

Are those what you're looking for?

You're using a custom module named "customLogic" right?
You should set its path in package.json file.

Relative & Absolute Folder Locations¶
It is important to note that this json file is located at the root directory of your Arena Cloud server and not the root directory of your server code. If you are referencing a custom module from your package.json you will need to put its relative path based of the Arena Cloud server root.

The relative path of your uploaded server code is ./app/server/arena/.

The absolute path of your uploaded server code is ./colyseus/app/server/arena/

@coco

Oh I see. I am using similar server code to the StarBoss Demo where it uses "competitive" and "collaborative" strings to decide game modes. I looked in their package.json and they don't have the paths for the "competitive" or "collaborative" logic listed. The logic I'm trying to access is in a custom Logic folder in the rooms folder.

I'll give it a shot though and list it in the package.json.

@coco

I found the issue! It was a typo. Thank you so much for your help Coco. Talking it out helps me figure out where to look. Your responses are super appreciated.

@gurulantern

Glad your problem was solved.