edi9999 / jsqrcode

[deprecated] Lazarsoft's jsqrcode as a node module, object oriented, and with tests
Apache License 2.0
278 stars 63 forks source link

Build jsqrcode using node and npm (error with lwip2 module) #49

Closed murdocha closed 6 years ago

murdocha commented 6 years ago

I'm attempting to build the node module for jsqrcode (and generate the needed JavaScript library) and failing. I'm working on a Windows 7 machine...

It looks like the lwip2 node module is not supported by node? Is the ELIFECYCLE code (in the error messages below) referring to "end of life cycle"? Is there an alternative approach that I should take to get this working? Alternatively, is there an easier way to get the jsqrcode prepared JavaScript library?

I'm attempting to use the docker run method outlined here (comment by joonas-fi): https://github.com/edi9999/jsqrcode/issues/38.

Here are the docker commands I'm using to generate the container and build the JavaScript library:

$ docker run --rm -it -v "/c/Users/amurdoch/Documents/dockershare:/buildresult" node:7 bash
root@2490fafa7aba:/# git clone https://github.com/edi9999/jsqrcode.git /work \
&& cd /work \
&& npm install \
&& npm run build \
&& cp dist/index.js dist/index.js.map /buildresult

This works well, up to a point. At the end of the installation process, I get these error messages:

npm ERR! Linux 4.4.93-boot2docker                                                                
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"                               
npm ERR! node v7.10.1                                                                            
npm ERR! npm  v4.2.0                                                                             
npm ERR! code ELIFECYCLE                                                                         
npm ERR! errno 1                                                                                 

npm ERR! lwip2@1.0.12 install: `node lib/install.js`                                             
npm ERR! Exit status 1                                                                           
npm ERR!                                                                                         
npm ERR! Failed at the lwip2@1.0.12 install script 'node lib/install.js'.                        
npm ERR! Make sure you have the latest version of node.js and npm installed.                     
npm ERR! If you do, this is most likely a problem with the lwip2 package,                        
npm ERR! not with npm itself.                                                                    
npm ERR! Tell the author that this fails on your system:                                         
npm ERR!     node lib/install.js                                                                 
npm ERR! You can get information on how to open an issue for this project with:                  
npm ERR!     npm bugs lwip2                                                                      
npm ERR! Or if that isn't available, you can get their info via:                                 
npm ERR!     npm owner ls lwip2                                                                  
npm ERR! There is likely additional logging output above.                                        

npm ERR! Please include the following file with any support request:                             
npm ERR!     /root/.npm/_logs/2017-11-27T21_15_54_694Z-debug.log                                 
edi9999 commented 6 years ago

Hello @murdocha .

Sorry for the late reply.

jsqrcode doesn't have the responsibility to "parse the images", this is done by other libraries. They are two that I know how to use , the first one is image-parser, which uses lwip, and the second one is jimp, which is full JS.

So that means that on windows, if you have issues with lwip, I would recommend to use jimp only to do the parsing.

For this, you do :

npm install qrcode-reader
npm install jimp

Then try to mimic the code shown in the test file using Jimp : https://github.com/edi9999/jsqrcode/blob/master/test/qrcode.js#L35