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
Related
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.
I'm using npm v 5.7.1 on Mac High Sierra. I just installed this module
npm install ssl-root-cas
(for some reason, adding "-g" didn't work). Then i have this in my JS file
require('ssl-root-cas')
.inject()
.addFile(fs.readFileSync(conf.root_cert));
However, upon executing the above code (specifically the "inject()" line), I get the error
/Users/satishp/Documents/workspace/projA/node_modules/ssl-root-cas/ssl-root-cas.js:3637
var filepaths = filepath.split(/\//g);
^
TypeError: filepath.split is not a function
at Array.module.exports.rootCas.addFile (/Users/satishp/Documents/workspace/projA/node_modules/ssl-root-cas/ssl-root-cas.js:3637:28)
at Object.<anonymous> (/Users/satishp/Documents/workspace/projA/server.js:79:3)
at Module._compile (module.js:662:30)
at Object.Module._extensions..js (module.js:673:10)
at Module.load (module.js:575:32)
at tryModuleLoad (module.js:515:12)
at Function.Module._load (module.js:507:3)
at Function.Module.runMain (module.js:703:10)
at startup (bootstrap_node.js:193:16)
at bootstrap_node.js:660:3
I'm somewhat confused about how to proceed. How do I overcome this error?
You just need to pass the file path for the addFile function, no need to manually load the file content:
require('ssl-root-cas')
.inject()
.addFile(conf.root_cert);
I have been looking around for the best framework with nodejs. I am starting to lean twords Zappa. I was testing it out and everything was working fine until I started a new project and reinstalled it with npm.
Now any time I do anything with it, it throws this error.
This
require('zappa') ->
console.log "Hello World!"
Becomes
TypeError: Cannot read property 'prototype' of undefined
at Object.<anonymous> (/home/giodamelio/Projects/node-boilerplate/node_modules/zappa/lib/zappa.js:65:15)
at Object.<anonymous> (/home/giodamelio/Projects/node-boilerplate/node_modules/zappa/lib/zappa.js:702:4)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object.<anonymous> (/home/giodamelio/Projects/node-boilerplate/src/app.coffee:3:3)
at Object.<anonymous> (/home/giodamelio/Projects/node-boilerplate/src/app.coffee:52:4)
What happened?
Recently I just had a similar problem with zappa 0.3.3
Apparently the creator of zappa is on vacation and doesn't update to the current versions of node.js, but you may use zappajs instead. It's a fork that is a little more up-to-date.
npm install zappajs
And use require('zappajs') instead of require('zappa').
I just started using node.js for my project and tried making a connection to MySQL and inserting basic values. But I keep getting the following error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Unable to load shared library /Users/****/nodeJS/node_modules/db-mysql/build/Release/mysql_bindings.node
at Object..node (module.js:472:11)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/Users/****/nodeJS/node_modules/db-mysql/db-mysql.js:18:15)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
I did as was instructed, I specified the MYSQL_CONFIG environment variable:
$ export MYSQL_CONFIG=/usr/local/mysql/bin/mysql_config
maybe it's too late and I hope you solved this problem on your own, but it might be useful for other people experiencing the same issue.
What I did to solve it is to set the following variable:
export DYLD_LIBRARY_PATH=<your absolute path to mysql lib folder>
in my case it is:
export DYLD_LIBRARY_PATH=/usr/local/mysql-5.5.25-osx10.6-x86_64/lib/
Tested on MacOS Lion 10.7.4
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.