nahanil / cjk-unihan

(Kinda crappy) Node.js interface to Unihan database of CJK characters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Newer node versions fails to use sqlite3

hugolpz opened this issue · comments

For reference, node 6.9.1 results into :

cri-ninja@hp-840:~/Documents/font-2-svg-files$ nodejs
> var cjkUnihan = require("cjk-unihan"); cjkUnihan.get("我", function(err, result){ console.log("Full lookup all done:", result); });
Error: Cannot find module '/home/cri-ninja/Documents/font-2-svg-files/node_modules/sqlite3/lib/binding/node-v46-linux-x64/node_sqlite3.node'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/cri-ninja/Documents/font-2-svg-files/node_modules/sqlite3/lib/sqlite3.js:4:15)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
> .exit

Examining the said link , I found out I have the /node_modules/sqlite3/lib/binding/node-v46-linux-x64/node_sqlite3.node (46).

I do :

npm uninstall sqlite3         # uninstall sqlite3
nvm use 4.6.1                 # switch to node 4.6.1
nodejs                        # opens js prompt
> var cjkUnihan = require("cjk-unihan"); cjkUnihan.get("我", function(err, result){ console.log("Full lookup all done:", result); });
{ all: 'Known data' }
> Full lookup all done: undefined

If you have an update, please push it, we would appreciate. We want to provide open license fonts to ease Chinese learning.

Curious :)

Turns out the code here on GitHub & what I pushed to NPM don't match. I've just pushed v0.0.2a. Fixes some file path issues with sqlite3 & hopefully now pulls in the correct dependencies.
Let me know if it works or you have some other ideas

jarrod@foo:~$ npm install cjk-unihan
/home/jarrod
`-- cjk-unihan@0.0.2-a
> jarrod@foo:~/workspace/testbed$ node -v
v6.9.1
jarrod@foo:~/workspace/testbed$ node 
> var cjkUnihan = require("cjk-unihan"); cjkUnihan.get("我", function(err, result){ console.log("Full lookup all done:", result); });
undefined
> Full lookup all done: { character: '我',
  SUnicode: '62.3',
  kIRGKangXi: '0412.010',
  kRSKangXi: '62.3',
......
}

Working ! Thanks you.

yup@hp-840:~/Documents/font-2-svg-files$ node cjkunihan.js 
Full lookup all done: { character: '思',
  SUnicode: '61.5',
  kIRGKangXi: '0381.040',
  kRSKangXi: '61.5',
  kIRG_GSource: 'G0-4B3C'
  ...
}

That may change the way I work on my project 💃

Yay :)