Node JS error: Cannot find module '../build/jvm_dll_path.json' - node.js

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.

Related

NestJS microservices "Cannot find module"

So, I'm trying to create my first microservice using NestJS, but the moment I try to run it, the service stops with this error:
[13:39:21] Found 0 errors. Watching for file changes.
Error: Cannot find module 'C:\Users\voryi\IdeaProjects\YWA\des_server\services\learning-service\dist\main'
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
there's no main.js file in the first level of your dist directory. You can define the entry file by adding this to your nest-cli.json:
"entryFile": "learning-service/src/main"
the default is main
try npm run build and then restart your service
I use monorepo setup and this issue happens whenever I start the nestjs server from non-root folder by mistake.
Usually, removing the dist folder and restarting the nestjs server works for me.
In my case, the main.js file was inside src folder so I had to change the script to:
"start:prod": "node dist/src/main"
maybe simply use this inside the project,
npm i #nestjs/microservices

Nodemon app cannot find module when restarting

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

Mongoose on c9 how to fix

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.

Node.js NPM config error - " Error: Cannot find module './config/mail' "

Im following a book called "Building Node Applications with Mongo and Backbone". What im creating is a small social network site. Ive followed the steps through but am getting an error with npm config (I think)
when i run the app.js file it comes up with this error
> Error: Cannot find module './config/mail'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
this is the relevant code its referring to.
// Import the data layer
var config = {
mail: require('./config/mail')
};
Any suggestions on how to fix this? Thanks.
Try to install module with npm as admin in console: sudo npm install

NODE_PATH is being ignored or not working

I'm trying to run my node app on a new server and am having some issues with the NODE_PATH environment variable. The app works fine on my local machine (OSX Lion) but not on the server (Redhat linux). When starting my app with node app.js from within my project directory /development/nodeproject, I get the following error :
Error: Cannot find module 'mod/core/models/Category'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at /development/nodeproject/app.js:57:5
at Object.<anonymous> (/development/nodeproject/app.js:258:1)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
mod/core/models/Category is the first require() in my app.js and looks like this: var Category = require('mod/core/models/Category'). So apparently node is not looking for modules in my project directory.
I'm not sure why though, because I made the following changes (that are working just fine on my local machine).
added export NODE_PATH=/development/nodeproject to my ~/.bash_profile
ran source ~/.bash_profile
if I run env I see NODE_PATH=/development/nodeproject listed there
in my app.js if I console log process.env.NODE_PATH I get /development/framework (should this output an array instead of a string?)
Other information that might be relevant:
I'm on node v0.6.7
I'm doing all of this as root (sudo su -)
At this point I'm not sure what else I can do. Any help would be greatly appreciated.
NODE_PATH used for modules, not for solutions files.
Try
module.paths.push("/development/nodeproject", "one/more/path");
before any require() call. And you really should use a relative require like require('./mod/core/models/Category') for files in your nodeproject directory
The functionality you are looking for was removed. Use the node_modules directory or a relative require like require('./mod/core/models/Category').
This answer has more info: NODE_PATH error with node.js while attempting to setup jsctags for vim

Resources