Error: Cannot find module while trying to run with nodemon - javascript

I am trying to start two servers using nodemon.
"scripts": {
"start": "node server.js && node serverpage.js"
},
I installed nodemon correctly and when I try to execute it I get the following error:
Error: Cannot find module 'C:\Users\puppe\Desktop\alles\Login-Projekt\login.js'
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Now the thing is that I can start both servers independently with no problems but they're failing to start together. Any ideas?

Related

How do I solve this error message? I'm missing server.generated.js

Whenever I try to run my app with npm start in the terminal, this is the error I get:
iteh-projekat#1.0.0 start
> NODE_ENV=production node ./dist/server.generated.js
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '/Users/mihailomitrovic/Downloads/iteh_projekat/dist/server.generated.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Could someone help me with fixing this? The dist folder is empty, so I'm not sure what's happening. I've done npm install when pulling it from Github, since I'm working on it with friends for a uni project. Thank you!

Cannot find module '/workspace/index.js' error after repository push attempt to railway.app

I just had an error I just fixed, but now I am getting this error saying cannot find module workspace, I have no idea what workspace is.
Here is the full error:
Error: Cannot find module '/workspace/index.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I don't know how to fix this issue so I would really appreciate it if someone helped me with this one. If you can't help but had the time to view it, still thank you!
1.Do you have Node.js installed on your machine?
2.If you have installed node.js, use <node (name of your main file).js> to run
3.Check for the following in the JSON file:
"scripts": {
"start": "node index.js"
},

Cannot find module error when running JS in terminal

It's my firt time using node today and I was faced with this issue. When trying to run hello.js in my terminal, I get this error :
Error: Cannot find module '/Users/antoinelafonta/hello.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
It's running fine when using the VsCode terminal.
Any ideas ?
Thanks !

throw err/MODULE_NOT_FOUND

I am having this issue when trying to run node index.js in my terminal on VSC.
This is the error,
[Try the new cross-platform PowerShell https://aka.ms/pscore6
PS Z:\01 Code notes> node index.js
node:internal/modules/cjs/loader:944
throw err;
^
Error: Cannot find module 'Z:\01 Code notes\index.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)
at Function.Module._load (node:internal/modules/cjs/loader:774:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
PS Z:\01 Code notes> ][1]
I have tried so many different things. I tried all the suggested fixes on these pages,
Node MODULE_NOT_FOUND
Why does VsCode NPM throw a module not found error?
https://github.com/Microsoft/vscode/issues/65893
Any suggestions?
That means you are using a module that you haven't installed, check your code.

Node 14.16.0: Error-Messages after Update

I've updated Node from version 12.x.x to 14.16.0. After this I get serveral error messages when I try to start the server.
In the package.json I defined under the scripts object a key "start" with value "nodemon server.
"scripts": {
"test": "Hello World",
"start": "nodemon server"
In the Terminal I call npm start and get the following error:
npm ERR! missing script: start
I also tried node server. But that isn't successful too. The message is:
internal/modules/cjs/loader.js:883 throw err; ^
Error: Cannot find module
'C:\Users\Marco\Desktop\Studium\UndsoKram\server'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15) at Function.Module._load
(internal/modules/cjs/loader.js:725:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Have someone a idea how too fix that? Is it necessary to go back to node version 12.x.x.?

Categories

Resources