Vps ovh server configuration - node.js

i am using ovh vps to deploy my nodejs application , i installed Git , nodejs, angular cli , npm , but in the last step when i type : node server.js & it show me this error :
` root#vps769904:~# internal/modules/cjs/loader.js:638
throw err;`
`Error: Cannot find module '/root/server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)`
can anyone help me please !

the solution was : ngserve --url of my server port 4200 ! it works good !

Related

Can't run node.js server locally

I'd like to run node.js server on my machine but I get this error. What should I do? (Please note I'm not programmer :)
MBP-Mike:~ michal$ node server
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '/Users/michal/server'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
to run a nodejs server:
node
example: if your server file is called server.js
node /Users/Michal/server.js
it seems like you missed the .js extension on your command.
node server.js
Or you can just run
node .

Cannot debug NodeJS application

I'm trying to debug my NodeJS application (v10.4.0), using the command:
node --inspect-brk index.js
What I get trying to connect to chrome://inspect page for my application is:
Error: Cannot find module 'C:\Users\path\to\my\app\index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
at Function.Module._load (internal/modules/cjs/loader.js:520:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
at startup (internal/bootstrap/node.js:238:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)
What am I doing wrong? Thanks
Check which is your entry point, as you mentioned you are trying to debug with index.js but if does not exist then it shows the cannot find module error.

Cannot find module '..\npm\node_modules\yo\lib\cli.js'

when i am trying to add endpoints using command "yo angular-fullstack:endpoint name", i am getting this error:
module.js:341
throw err;
^
Error: Cannot find module 'C:...npm\node_modules\yo\lib\cli.js'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:140:18)
at node.js:1001:3
while running command npm-install, i am getting this error
> error C2373: '__pfnDliNotifyHook2'
solved by changing the node version to a newer version

Error pointing to non-existent file when running Node.js app locally

I was just sent the files for a Node.js app (which is working without issues online) and I'm trying to set it up on my Windows machine.
I have Node server running, but I'm stuck trying to actually load the app. I can navigate to the directory with the Node command prompt, and there's an app.js (plus folders like config, components etc) in there which I've been trying to run, but I am getting the following error:
D:\my-directory\game-master>node app.js
module.js:327
throw err;
^
Error: Cannot find module 'config'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (D:\posao\aktivni projekti\smart rebellion\game-master
\app.js:7:10)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
The thing is, there is no file titled module.js in the directory. I presume it's a built in Node.js file, but then how do I troubleshoot this?
My best reading of the error is that there should be a config.js file somewhere, but that doesn't make sense because these same exact files work with no hickups on a remote server.
If you want to require('./config'), where config is a directory, the file ./config/index.js should exist.
You can't require('config') however, because node.js will try to find it in node_modules.
Check out node.js modules documentation where the require algorithm is well explained.

Why isn't bin/www command not working in my cloud9 (c9) new run configuration?

I'm following along with a Lynda course on MEAN Stack development and while they are running bin/www command in a "New Run Configuration" and its yielding "debugger listening on port 15454"
whereas for me, when I enter bin/www, I get the following error:
debugger listening on port 15454
module.js:340
throw err;
^
Error: Cannot find module '/home/ubuntu/workspace/bin/www'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.runMain [as _onTimeout] (module.js:497:10)
at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)
When you clone a empty repo from BitBucket it creates a workspace folder. Move the contents of that folder to the root of your cloud9 project.
OR
start from scratch and make sure to run "express . --hbs" in the correct folder
Run
**#**:~/workspace (master) $ express . --hbs
Not
**#**:~/workspace/workspace (master) $ express . --hbs

Resources