I'm facing the following error message on Windows 10x64 for Java module while executing javascript code:
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'java'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Users\Rau\Desktop\Test.js:1:12)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)"
var java = require('java');
var javaLangSystem = java.import('java.lang.System');
The java module is not automatically available (i.e. it is not included with node.js ). It is available through the npm registry: https://www.npmjs.com/package/java
What this error is trying to tell you is it looked in all the paths for the java module and could not find it.
Make sure you have the java module installed via:
npm install java
Related
I am very new using discord's javascript
This is also my first time posting on stackoverflow!
Anyway
Here's the full error
Error: Cannot find module 'discord.js'
Require stack:
- /home/runner/multiple-purpose-discord-bot-like-carlbot/xp.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/runner/multiple-purpose-discord-bot-like-carlbot/xp.js:1:17)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/home/runner/multiple-purpose-discord-bot-like-carlbot/xp.js' ]
}
To my limited knowledge, this is either i made a typo
OR some package is outdated, here's the full packages list
I also suspect that i incorrectly implemented the amethyste-api i am using, here's my code
It's in a config file, should've i put const mySecret = process.env['ame'] in the main file instead?, I do need it to be in the config for ease of access
npm install discord.js (manually through console/shell)
did do some stuff but stil didn't work
npm xp.js (manually through console/shell)
this is what i am supposed to run on start manually, that what gives the error
You could run the following commands one after the other:
`npm init`
and then
`npm i discord.js`
Find Visual Studio Code application where I tried to run the file. Things look fine but it says cannot find module. Find my terminal output below along with screenshot in "Node Program"
F:\Git Clone\Node.js_From 31Oct2019\IBM-Developer\Node.js\Course\Unit-6>node server.js
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'sqlite3'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (F:\Git Clone\Node.js_From 31Oct2019\IBM-Developer\Node.js\Course\Unit-6\utils\utils.js:23:17)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
Node Program
You have to run npm i and then restart your application and vs code.
Install NPM by typing npm i and then restart your application
I want to make a new project running npm install -g create-react-app on the folder directory. After doing this I get the following error:
module.js:487
throw err;
^
Error: Cannot find module '../package.json'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:30:15
at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
Your question is not very precise. You should give more details about what you are doing.
Still, here are some suggestions. Make sure:
You run the command from within the folder, where your package.json is located.
If you have not created a package.json yet, run npm init
Your package.json is a valid format and readable
I am using node.js to run one app given by my professor on my chrome. Something wrong happen, but I don't know because I am a rookie.
The structure is as follows:
/app
/models
answers.js
questions.js
sessions.js
user.js
passport.js
qmanage.js
routes.js
/config
auth.js
database.js
mcd.js
package.json
/public
some css png fonts jpg document
qloader.js
server.js
/views
some ejs document
At first, it shows this problem:
module.js:457
throw err;
^
Error: Cannot find module 'mongoose'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/shen/Desktop/os/cse303.p2/server.js:2:16)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
then, based on this help Node.js error Error: Cannot find module 'mongoose' I run npm install mongoose in my root path of project. Then I have those error below:
dyn143030:cse shen$ node server.js
{ Error: Cannot find module '../build/Release/bson'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/shen/Desktop/os/cse303.p2/node_modules/bson/ext/index.js:15:10)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3) code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
events.js:160
throw er; // Unhandled 'error' event
^
Error: Invalid mongodb uri. Missing hostname
at muri (/Users/shen/Desktop/os/cse303.p2/node_modules/muri/lib/index.js:40:11)
at NativeConnection.Connection.open (/Users/shen/Desktop/os/cse303.p2/node_modules/mongoose/lib/connection.js:195:16)
at Mongoose.connect (/Users/shen/Desktop/os/cse303.p2/node_modules/mongoose/lib/index.js:212:15)
at Object.<anonymous> (/Users/shen/Desktop/os/cse303.p2/server.js:4:10)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
I tried to find solution from this help
Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version
but it seems not my case, because I am using OS X 10.11.3
dyn143030:cse shen$ node -v
v6.5.0
dyn143030:cse shen$ npm -v
3.10.3
From my aspect, I think the system find bson someplace wrong, so how to modify it? Thanks! If any more information is need, please tell me.
I find in node_modules\bson\ext\index.js
and change path on 10th line
bson = require('../build/Release/bson'); to bson = require('bson');
You can try adding mongoose to the dependency list in the package.json file, or also doing >npm install mongoose in the project folder.
I get this error when launching iron-node
buster-test run failed: Error: -c/--config: Error loading configuration /Users/r01010010/Projects/Mad/paysite/test/buster.js
Cannot find module '../build/Debug/addon'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:289:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Users/r01010010/Projects/Mad/paysite/node_modules/heapdump/lib/main.js:18:15)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
No idea on how to solve this.
Env: Node.js v0.10.40 with nvm, node-gyp v3.2.1
With iron-node you do not need this Module. You can read and write such things within dev-tools-window in the Profiles tab. There ist also this document which provides more details. https://github.com/s-a/iron-node/blob/master/docs/PROFILE.md