I'm currently building a RESTful API. I start my MongoDB server using the command mongod. When I restart my Node server (using rs), however, it throws the following error:
[nodemon] starting `node todoListApi`
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'C:\Users\Zakaria5\Desktop\Stage Technique
2019\zen-networks-backend\todoListApi'
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:622:3)
[nodemon] app crashed - waiting for file changes before starting...
I Googled this error, and the solution seemed to be to remove the node_modules directory. However, when I type rm -rf nodes_modules, it displays that the command is not found. I also tried using npm install and npm start, but this throws an error, as well. What am I doing wrong?
I resolve the problem by fixing the path !! Well , when i type npm install and npm start ! It displays an error which confirms that the file isnt available in a path by default !! (in my case) C/users/Zakaria/package.json !! when i look for that file i didnt find it ! Thus , I have to change the path which contains my package.json file . I used that command " npm start --prefix TheRealPath " Hence , the RESTful API starts on port : 3000 !! :P
Related
I created a simple server with express and was using nodemon as a dev dependency. But when I try to exec "npm run dev" getting the following error:
PS D:\R&D\node-backend> npm run dev
> backend#1.0.0 dev
> nodemon ./app.js
'D\node-backend\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
node:internal/modules/cjs/loader:942
throw err;
^
Error: Cannot find module 'D:\nodemon\bin\nodemon.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
at Module._load (node:internal/modules/cjs/loader:780: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: []
}
Node.js v18.1.0
PS D:\R&D\node-backend>
I tried different solutions from the net and reinstalled nodejs but nothing seems to work. I think there's an issue with where npm is trying to find the package. You can check code here.
I have the same problem in my react project and i found the problem from the folder structure.
I have to change the name of the folder from:
Module 3 practice M1&2 ===> Module 3 practice M1 and 2
for me that "&" is what causing the error
Hope this works
I am receiving the following error after running npm start:
Error: Cannot find module '../build/jvm_dll_path.json'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/opt/stature-gqdss/node_modules/java/lib
[nodemon] app crashed - waiting for file changes before starting...
Can you help me with this issue?
First, you should check if the server is already running and kill the existing server. If no other server is running, try reinstalling your dependencies and try again.
npm install
I have a hack here. You can simply create a file named jvm_dll_path.json inside node_modules\java\build and paste the path of server to this, between quotes like shown below..
";C:\\Program Files\\Java\\jdkX.X.X_XXX\\jre\\bin\\server"
For me running
node postInstall.js
in the node_modules/java folder worked.
I'm trying to create some cron jobs via the Heroku scheduler plugin. I've tested my node script on my local machine and it works fine, however, when I commit and push to heroku, when I run heroku run node check_work_orders.js, I get this error:
Running node check_work_orders.js on ⬢ fms-sandbox... up, run.4992 (Free)
module.js:471
throw err;
^
Error: Cannot find module '/app/check_work_orders.js'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:393:7)
at startup (bootstrap_node.js:150:9)
at bootstrap_node.js:508:3
For reference, I was following this guide.
What am I doing wrong here?
Since my node file was location in my app/check_work_orders.js file, I needed to run heroku run node app/check_work_orders.js. This solved my problem. It was just a matter of running node in the correct directory on the Heroku server.
I didn't close my mongod when closing the laptop and now its giving me an error. On top of that, I delete the mongod data directory with all my data in it. Now I can start up my apps using node js - is there anyway to fix this or do I need to redo all my app.js again?
Error: Cannot find module '/home/ubuntu/workspace/RESTful/RESTful
Routing/RESTfulBlogApp/cats.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3
All the files which are required in your node app must be present at the time of execution.
As per the error, it is unable to find cat.js in the required folder. You need to create again all the required files, and if they were your dbSchema, i would suggest you create your schemas again before running the app.
I have installed NodeJS, added Express on top and now I cant make FabricJS work.
Do I have to follow the steps in https://github.com/kangax/fabric.js/ under "Building" for FabricJS to work?
I tried running $ node build.js in the root of my app which gives me:
$ node build.js
module.js:327
throw err;
^
Error: Cannot find module 'D:\Drive\Personal\Sandbox\express-angular-app\build.j
s'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:134:18)
at node.js:962:3
And also in the fabric module folder which gives me:
$ node build.js
D:\Drive\Personal\Sandbox\express-angular-app\node_modules\fabric\build.js:93
if (err) throw err;
^
Error: ENOENT: no such file or directory, open 'D:\Drive\Personal\Sandbox\expres
s-angular-app\node_modules\fabric\HEADER.js'
at Error (native)
I use Jade and I have the following in my index.jade and fabric.js:
index.jade and fabric.js
The problem was that I confused back-end vs front-end. I was expecting the code to work from the backend by installing the fabric module via npm.
Instead I just added the CDN link in the head and it run in the client.