Unable to load /nowjs/now.js - node.js

When I start the server, I get the following error
[Error: Unable to load shared library /home/boopathi/node_modules/now/node_modules/node- proxy/lib/node-proxy.node]
Error: Unable to load shared library /home/boopathi/node_modules/now/node_modules/node-proxy/lib/node-proxy.node
at Object..node (module.js:465:11)
at Module.load (module.js:353:31)
at Function._load (module.js:310:12)
at Module.require (module.js:359:17)
at require (module.js:370:17)
at Object.<anonymous> (/home/boopathi/node_modules/now/lib/proxy.js:10:13)
at Module._compile (module.js:434:26)
at Object..js (module.js:452:10)
at Module.load (module.js:353:31)
at Function._load (module.js:310:12)
When I make the node-proxy module manually, I get the following warning..
[2/2] cxx_link: build/Release/node-proxy_1.o -> build/Release/node-proxy.node
in yellow color...
Now I'm not able to load the /nowjs/now.js file
I tried --harmony_proxies .. but it did not help ..

This should help you find it out:
Fire up gdb node. Type break node.cc:1624, then type run yourscript.js. When gdb hits the breakpoint, use p/a dlerror() to obtain the address of the error. It should print something like $123 = 0xabcddefg. Now use x/s 0xabcddefg (insert the address you got from the last command) to see the error. Is the error helpful?

I encountered same problem with bcrypt and found it's because my node was 32bit and bcrypt was build as 64bit. After I build a 64bit node, all things work fine.

I´ve tried this solution without success.
I guess the team made NowJS need to fix it current support in all plataforms. I cannot run NowJS under either Mac and Windows.
There is no way to accomplish it. Maybe some further version allow me to play with NowJS, but NOW, I can´t do it.

Related

Invalid ELF Header on Production Server

Does anyone know why this error is occurring only on the production server and not when I run it locally?
internal/modules/cjs/loader.js:815
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: /var/www/vhosts/user9568/**SITE_NAME**/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: invalid ELF header
at Object.Module._extensions..node (internal/modules/cjs/loader.js:815:18)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:681:19)
at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/var/www/vhosts/user9568/**SITE_NAME**/node_modules/bcrypt/bcrypt.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
The live server uses Plesk. I would appreciate any suggestions.
Also, please note that * * SITE_NAME * * is the domain name of the site, I didn't want to include it in this post for obvious reasons.
Picture of Error
I found the answer because I installed bcrypt on a Windows machine, but the production server is running Linux meant that it didn’t have the correct files to work with.
I fixed it by installing bcrypt on a Linux machine and then uploading it to the hosting server.
Do you use Docker? If yes, this question on Stack Overflow may already give you the answer.
TLDR: The .dockerignore file should include your node_modules folder.

ReferenceError: window is not defined in godash

I am trying to build a board game and want to use godash to create a board state and update it. I have successfully installed godash into my package.json, but when I require it in the back-end, in my server.js (the file in which I run my server),
var godash = require ('godash');
and I run node server.js, the CLI responds with this error:
ReferenceError: window is not defined
at Object.<anonymous> (C:\Users\Chidi\gt\projects\Chess-vs-Go\node_modules\godash\dist\godash.js:1:194)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\Chidi\gt\projects\Chess-vs-Go\game_state\go_state.js:2:14)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
I've seen various "window is not defined" questions on this site in my effort to solve this problem, and the general solution seems to be that the code should be used in a browser environment. However, this is godash, an npm package that is to be used in the back-end. I have tried updating node.js and npm to their latest versions, but the problem still persists. I feel like I am making an obvious error that I can't see, because I went to the github page for godash and did not find any closed or open issues similar to this one. Does anyone know what the issue is, and how I can resolve it?
So, upon further research, I found that there are ways to use npm packages in the browser (e.g via browserify) This allowed me to use godash in the browser, where it was looking for a window object.

Use edge js on openshift

I'm trying to run C# on my OpenShift cartridge with Edge.js. It runs really good on my Windows PC and I would like to have it running on the cloud.
I'm guessing it runs on a Linux environment but I'm not shure.
At first I tried to make it work with my MSSQL DB and than move on to the C# assembly.
Nevertheless I'm doing the same steps as how I've got it to work on my Windows machine but I'm getting thesame errors over and over again.
I've added edge and edge-sql to my npm and my package.json.
Then I've make a simple count to my MSSQL DB.
When I'm running it locally it works great. Than I push it to OpenShift and I tail the application, because the front-end gives me an Error 503, and the next thing I know the following error makes me keepings my hands in my hair.
Error: The edge native module is not available at /var/lib/openshift/54d26260fcf
933d05e00021a/app-root/runtime/repo/node_modules/edge/build/Release/edge.node. Y
ou can use EDGE_NATIVE environment variable to provide alternate location of edg
e.node. If you need to build edge.node, follow build instructions for your platf
orm at https://github.com/tjanczuk/edge
at Object.<anonymous> (/var/lib/openshift/54d26260fcf933d05e00021a/app-root/
runtime/repo/node_modules/edge/lib/edge.js:33:11)
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)
at require (module.js:380:17)
at Object.<anonymous> (/var/lib/openshift/54d26260fcf933d05e00021a/app-root/
runtime/repo/server.js:5:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
DEBUG: Program node server.js exited with code 8
DEBUG: Starting child process with 'node server.js'
/var/lib/openshift/54d26260fcf933d05e00021a/app-root/runtime/repo/node_modules/e
dge/lib/edge.js:33
throw new Error('The edge native module is not available at ' + builtEdge
Could somebody help me to fix this error or maybe explain to me why it could / wont work?
If edge requires a native windows environment to run C#, then it will not work on OpenShift, which runs on Red Hat Linux.

How to use node-oracle with iisnode?

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!

Node.js module cannot be required

I have written a Node.js server on the Raspberry pi, and have successfully previously used several modules in it.
However, in the most recent version, which requires the package serialport, I have received the following error message:
/home/pi/hub/node_modules/serialport/node_modules/bindings/bindings.js:85
throw err
^
Error: Could not load the bindings file. Tried:
-> /home/pi/hub/node_modules/serialport/build/Debug/serialport.node
-> /home/pi/hub/node_modules/serialport/build/Release/serialport.node
-> /home/pi/hub/node_modules/serialport/out/Debug/serialport.node
-> /home/pi/hub/node_modules/serialport/Debug/serialport.node
-> /home/pi/hub/node_modules/serialport/out/Release/serialport.node
-> /home/pi/hub/node_modules/serialport/Release/serialport.node
-> /home/pi/hub/node_modules/serialport/build/default/serialport.node
-> /home/pi/hub/node_modules/serialport/compiled/0.6/linux/arm/serialport.node
at bindings (/home/pi/hub/node_modules/serialport/node_modules/bindings/bindings.js:82:13)
at Object.<anonymous> (/home/pi/hub/node_modules/serialport/serialport.js:7:44)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:32)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object.<anonymous> (/home/pi/hub/server.js:8:15)
at Module._compile (module.js:446:26)
I have tried searching for this error, including on stackoverflow, but the few solutions that I found did not fix the problem.
UPDATE:
For reasons I cannot discern, I'm now getting a different error. I don't remember changing anything.
/home/pi/hub/node_modules/serialport/node_modules/bindings/bindings.js:77
throw e
^
Error: Unable to load shared library /home/pi/hub/node_modules/serialport/build/Release/serialport.node
I've doublechecked, and I'm pretty sure that serialport is installed in the right directory
Turns out that this will work if you install an earlier version of serialport:
npm install serialport#0.7.3
Guess the later versions weren't compatible with my version of nodejs

Resources