Launch application with nodejs
I want to test an application on Debian VirtualMachine with nodejs installed.
My friend dev give me this code to run on my VM
I don't know hox to launch code.
I tried to do " node httpserver.js" for launch the game but when i go on http://ipserver/httpserver.js i can't load the page.
Can you explain how node works please
You start a node application from within the directory that holds the package.json ("Folder Root").
You can run
node .(optionally followed with program arguments) in there.
What that application does is defined by the application itself, I doubt it would provide its own source code as you're trying to access it.
Ask your friend how to communicate with the running application. Since it seems to be a server it's most likely listening to any port like
A well-written server should output such information on startup.
Don't work but it's on the root on my apache2
@Rémy-Verger It's not
node path/to/the/application/, so if you're already within the directory you can give it a
.as path (
.= current directory).
node /var/www/, those are equivalent.
Thanks dude but it's don't work.
Library probblem ? Or code error ?
Does it work if you call
npm installwithin /var/www first (I assume you have
npminstalled)? I just noticed you haven't done that yet, it installs dependencies for that project.
@frissdiegurke are you sure it's not
Perhaps OP could also try
@julian Did you mean
node package.json? I don't see any server.json. Yes, I am sure. Calling the package.json with node will not start any application, It would (probably; I have no way proving this) interpret the JSON content alike
require("./package.json")but won't start the
Woops, I meant
node server... either that, or
serverought to be an executable. Would have to look inside the file to know for sure
@julian server is a directory (see OP) it could be server/httpServer.js thought, but the package.json should specify the entry point anyways; Thus
node .within the directory containing package.json is always best.
Oh thanks i didn"t install npm
But now when i did "npm start" and i want to execute the code i got this error
ty guys BTW
@Rémy-Verger What program is this anyway? Perhaps you're better off asking them directly for help