I'm having trouble trying to run a Node.js server with node-oracle via iisnode. The iisnode examples all work, and running the server [on a different port] in a Command Window works perfectly. The server setup is based upon "The Node Beginner Book" example (i.e. index.njs -> server.njs -> router.njs -> requesthandlers.njs). I renamed all of my node files as *.njs and currently have my web.config set up for iisnode to handle all files of that extension, with a rewrite rule to forward the incoming requests to index.njs. The problem occurs when node-oracle -- utilized within requesthandlers.njs -- attempts to call oracle_bindings.node:
Application has thrown an uncaught exception and is terminated:
Error: The specified module could not be found.
c:\Program Files\iisnode\www\Reports\node_modules\oracle\build\Release\oracle_bindings.node
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (c:\Program Files\iisnode\www\Reports\node_modules\oracle\lib\oracle.njs:2:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
I've given read/write/execute permissions to the IIS_IUSRS group on every folder imaginable within the .\iisnode\www\Reports\node_modules\oracle path. I've also attempted the solution in Node cannot find modules in IIS, can find from prompt to no avail. While I could probably just set the server up as a service, I'd prefer to have it through IIS so that I don't have to battle with CORS while supporting IE9. Any help is greatly appreciated, thanks!
Related
I have bot in Discord Bot Maker. Its working perfectly on my pc (Windows 10), but when I move it to my VPS (Ubuntu 16.04) and try to start it using node bot.js, I will get error with missing module.
Error:
module.js:550
throw err;
^
Error: Cannot find module './constants'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/justwolf/butter/node_modules/ws/lib/websocket.js:19:19)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
bot.js: https://hastebin.com/koredupoka.js
The error :
Error: Cannot find module './constants'
means that somewhere in your code you have
.... = require('./constants')
but the file constants.js doesn't exist or at least not where it's supposed to be. Maybe when you uploaded your bot script to your VPS you forgot to upload that file.
Sometimes, in ready-made scripts, configuration variables such as database credentials and stuff are stored in a file named constants.js and this file is not versionned (it has en entry in .gitignore). Maybe you have a file named constants.js.dist or constants.js.example. It means you need to edit it and rename it to constants.js
I am trying to get a simple Kafka consumer up and running on Heroku. I am using Node 8.11 and node-rdkafka. I have it running locally. When I try to run it on Heroku, I get this error:
Error: librdkafka++.so.1: cannot open shared object file: No such file or
directory
at Object.Module._extensions..node (module.js:681:18)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at bindings (/app/node_modules/bindings/bindings.js:81:44)
at Object.<anonymous> (/app/node_modules/node-rdkafka/librdkafka.js:10:32)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
I know the library is a wrapper for librdkafka and it looks like it just can't find it. According to the list of things preinstalled on Heroku Ubuntu instance, it looks like librdkafka-dev and librdkafka1 are installed. I don't know how to use those, or if something else is going on.
You have to use the Confluent librdkafka package.
Add this to your Aptfile:
:repo:deb [arch=amd64] http://packages.confluent.io/deb/4.0 stable main
Still having issues after doing this, but they are different issues and it looks like I'm closer.
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.
I have installed ghost blog on Openshift and created local copy to make some changes. I added new theme and deployed it back to openshift. Its working fine but I am not able to run this blog on my local machine.
If I run NPM start, I am getting following error:
> openshift-ghost-quickstart# start C:\Users\darklord\OneDrive\Business\mean
> node index
Unhandled rejection Error: Cannot find module 'C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\sqlite3\lib\binding\node-v47-win32-x64\node_sqlite3.node'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\sqlite3\lib\sqlite3.js:4:15)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Client_SQLite3.initDriver (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\knex\lib\dialects\sqlite3\index.js:41:24)
at new Client_SQLite3 (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\knex\lib\dialects\sqlite3\index.js:15:10)
at Knex.initialize (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\knex\knex.js:109:15)
at Knex (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\knex\knex.js:13:26)
at ConfigManager.set (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\core\server\config\index.js:156:24)
at ConfigManager.init (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\core\server\config\index.js:79:10)
at C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\core\server\config\index.js:273:30
at tryCatcher (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\bluebird\js\main\util.js:26:23)
at Promise._settlePromiseFromHandler (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\bluebird\js\main\promise.js:507:31)
at Promise._settlePromiseAt (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\bluebird\js\main\promise.js:581:18)
at Promise._settlePromises (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\bluebird\js\main\promise.js:697:14)
I though that this errpr has something to do with sqlite3 so I have uninstalled and installed it back but still same error.
Can someone let me know what mistake I am going ?
In case other people are running into this issue.
You are probably running a different node.js version on your local machine.
You could check manually in the {gostblog}\node_modules\ghost\node_modules\sqlite3\lib\binding\ folder if you have a different version than the node-v47-win32-x64 he is asking for.
Just reinstall the Ghost dependencies on your local machine to get it running.
I am trying to deploy a node app on Linode (Ubuntu 12.04) while following this guide from Node Knockout: http://blog.nodeknockout.com/post/9300619913/countdown-to-ko-14-deploying-your-node-js-app-to
I have no problems running the server as root, but when trying to start the server as the "deploy" user using sudo start node, I get this error:
/home/deploy/app/source/node_modules/bcrypt/node_modules/bindings/bindings.js:79
throw e
^
Error: Module version mismatch. Expected 11, got 1.
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at bindings (/home/deploy/app/source/node_modules/bcrypt/node_modules/bindings/$
at Object.<anonymous> (/home/deploy/app/source/node_modules/bcrypt/bcrypt.js:1:$
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I have tried recompiling bcrypt using make clean then make since I thought my module version was incompatible with my version of node (v0.8.18), but that does not seem to be the case since I can start the server as root with no problem. I feel as though the problem lies in how I set up the deploy user, but I am not sure how to proceed.