After I git clone my app onto EC2 and run it with the following command:
nohup nodejs app.js &
I get the following error:
[Error: /home/ubuntu/bluesky-scheduler2/node_modules/agenda/node_modules/mongodb/node_modules/bson/build/Release/bson.node: invalid ELF header]
js-bson: Failed to load c++ bson extension, using pure JS version
[Error: /home/ubuntu/bluesky-scheduler2/node_modules/mongodb/node_modules/bson/build/Release/bson.node: invalid ELF header]
js-bson: Failed to load c++ bson extension, using pure JS version
Any ideas how can I fix this?
I had the same issue. The invalid ELF header implies a binary that is not loadable or executable by the system. So I tried to build bson.
go to the root directory of the bson module.
e.g. in my case: mongodb/node_modules/bson
and then execute make
tldr;
$ cd /home/ubuntu/bluesky-scheduler2/node_modules/agenda/node_modules/mongodb/node_modules/bson/
$ make
This happened to me when I inadvertently committed the node_modules/mongodb folder in git after developing on a windows box. Most node modules will be generic javascript an run on either windows or linux, however mongodb has binary files specific to the operating system in the node_modules/mongodb folder. Deploying the code to linux pushes a windows binary to linux, hence the error.
The solution is to remove the nodemodules/mongodb directory on the linux server, then run npm install to install mongodb dependancies from the linux environment.
Related
I am trying to get my development environment up and running for my Shopify app and it has been awhile. Shopify updates so rapidly I am forced to either reintegrate my code with a new Shopify app instance or try to get the original to work. Unfortunately, I cannot run my current application because sqlite3 will not work / install. I have tried installing from the source as recommended by the NPM documentation. I keep getting this error:
web/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-x64/node_sqlite3.node: invalid ELF header
Apparently this has to do with the binary not matching my system, which it is supposed to after running "npm install -g sqlite3 --build-from-source". Is there a way to install a specific build so that I can simply test all the linux builds to see if I can find a potential match or see if anything works?
While starting composer rest server I am getting error :
Connection fails: Error: Failed to load connector module "composer-connector-hlfv1" for connection type "hlfv1". Cannot find module '/home/user/.nvm/versions/node/v8.9.3/lib/node_modules/composer-rest-server/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node
there is no grpc_node.node file present in the above folder. I tried reinstalling compoer rest server but no luck.
There are lots of reasons for this. the grpc module is a binary module and usually npm will download a prebuilt binary for your platform. If however it cannot do that (eg server down, or the platform is not recognised) then it will attempt to build the binary from source.
You need to look at the output during the npm -g install of composer-rest-server to see what is reported when npm attempts to install grpc to determine what the problem is.
The following advice from another thread has worked for me. Please try:
Rebuild it
Go to the folder cd '/root/.nvm/versi ons/node/v8.9.1/lib/node_modules/composer-rest-server/'
(into the folder where you have 'composer-rest-server')
then run npm rebuild --unsafe-prem
It will work now
source - Error while generating REST api using hyperledger composer-rest-server in centOS
Just installed Mongo, mongodb driver and node. All current stable versions on a Ubuntu 14.04
mongo --version
MongoDB shell version: 3.2.1
node --version
v5.2.0
I'm pretty new to koa/mongo/node so I clone some github repos, but when I run code I always get this error:
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
Similar erros on stackoverflow are for older versions and there was either not clear solution or not working in my case.
How is the workflow? What is this extension for?
I tried reinstalling build-essential and node-gyp but without knowing the reason. Maybe is related to the monk or mongoose version if the projects are "old"?
You may be missing some build tools on your system.
In that case mongo driver will fallback to using a Javascript version of the bson parser, which is fine for development, but probably not in production.
Here is the solution:
cp ProjectDirectory/node_modules/monk/node_modules/mongodb/node_modules/bson/browser_build/bson.js ProjectDirectory/node_modules/monk/node_modules/mongodb/node_modules/bson/build/Release
I think you can use also move, I never tried.
The error message tell you bson.js is missing in "../build/Release folder", so you only have to put the file in the right place
Have been trying to installing/ running 'serialport' on Node.js but it fails.
First I tried installing the current version 0.7.3 and it fails with the following errors
Waf: Leaving directory `/home/anand/node/node_modules/serialport/serialport_native/build'
'build' finished successfully (0.237s)
cp: cannot stat `build/Release/serialport_native.node': No such file or directory
Next I tried installing version 0.6.7. It installs correctly but when I try to run the examples I get the following error
Error: Unable to load shared library /home/anand/node/node_modules/serialport/serialport_native.node
I have checked that the library exists and has read/write/execute permissions.
I have also checked with different versions of Node including 0.6.4, 0.6.10
I'm trying to require any NodeJs addon that used "node-waf configure build" when installed with no luck. I keep getting the same message:
Error: Unable to load shared library /Users/xxxx/node_modules/pdfkit/node_modules/flate/lib/zlib_bindings.node
Error: Unable to load shared library /Users/xxxx/node_modules/rsa/rsaBinding.node
Error: Unable to load shared library /Users/xxxx/node_modules/dcrypt/build/default/dcrypt.node
addons I tried:
pdfkit, rsa, dcrypt
I'm on MacOsx 10.6.8, nodejs v0.6.5, npm .1.0-alpha-6
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 now.
PDFKit now uses the builtin zlib module from Node instead of the old flate dependency.