Skip to content
Sign UpLog In
Profile icon

J W

@Nightstrike
They/Them | 19 | USA ------ Dabbler in JS and Java despite origins in Python; Deeply obsessed with Transformers.
  • Manager-Bot - Terminus Industries - {Public Activation}

    Cover page
    Made with Node.js
    Recent comments (0)
Repls
Community
Nightstrike
Nightstrike
published an Update
1 year ago
0
Terminus-game-dev-1
Terminus-game-dev-1W.I.P. import for streamlining game development for easy testing. I'm working on establishing the functions first.
__dirname? "../"? I'm not well acquainted with fs.js...
Bumping this because I've hit another snag. I converted this to an NPM package (terminus-game-dev-1) but I can't get it to refer back to the home directory instead of the package's directory. I'm essentially trying to compress the formatting for creating an html game into a simple 'plug-and-play' concept, but it's stuck at the package level, and won't descend to home/runner.
Nightstrike
Nightstrike
published an Update
1 year ago
0
Terminus-game-dev-1
Terminus-game-dev-1W.I.P. import for streamlining game development for easy testing. I'm working on establishing the functions first.
An absolute NPM noob seeks help...
I have thus far set up my packages via NPM and Github, but I'm struggling to utilize the functions. They're registering properly, but I keep receiving an error on import and usage. Source Testing Ground Since I effectively have no clue what I'm doing, could someone shine a light on what needs to be changed? The aforementioned errors are just your standard ERRINVALIDCALLBACK and ENOENT: no such file or directory, mkdir... for fs.mkdir. I'm genuinely stumped, because this is my first time trying to set up a package. EDIT: I've since fixed the ENOENT error thanks to SixBeeps, but now another error is cropping up. I'm trying to use the Source as a package in my testing ground, but it's now returning this error in both: `TypeError: path must be absolute or specify root to res.sendFile at ServerResponse.sendFile (/home/runner/Terminus-game-dev-1/node_modules/express/lib/response.js:425:11) at /home/runner/Terminus-game-dev-1/index.js:57:12 at Layer.handle [as handlerequest] (/home/runner/Terminus-game-dev-1/nodemodules/express/lib/router/layer.js:95:5) at next (/home/runner/Terminus-game-dev-1/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/home/runner/Terminus-game-dev-1/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handlerequest] (/home/runner/Terminus-game-dev-1/nodemodules/express/lib/router/layer.js:95:5) at /home/runner/Terminus-game-dev-1/node_modules/express/lib/router/index.js:281:22 at Function.processparams (/home/runner/Terminus-game-dev-1/nodemodules/express/lib/router/index.js:335:12) at next (/home/runner/Terminus-game-dev-1/node_modules/express/lib/router/index.js:275:10) at expressInit (/home/runner/Terminus-game-dev-1/node_modules/express/lib/middleware/init.js:40:5)`
SixBeeps
SixBeeps
@Nightstrike This isn't a packaging issue, but rather a file system issue. You should swap the terms in `("../")+__dirname` because __dirname gives you an absolute path, but .. is a relative modifier.1 year ago
Nightstrike
Nightstrike
@SixBeeps I've adjusted that, and now it starts up fine. However, it now returns this: `Error: ENOENT: no such file or directory, stat '/home/runner/Terminus-game-dev/node_modules/terminus-game-dev-1/servers/lobby.html' Error: ENOENT: no such file or directory, stat '/home/runner/Terminus-game-dev/node_modules/terminus-game-dev-1/servers/lobby.html'` 1 year ago
Nightstrike
Nightstrike
@SixBeeps I guess what I'm wondering is how to reference the directory it's writing files to as a package, as __dirname defaults to the package itself, and breaks the main bit of functionality.1 year ago