I have the most recent version of node.js built with no problems. I am trying to use a sqlite module for node.js.
For node-sqlite3 by developmentseed, I followed the directions:
git clone git://github.com/developmentseed/node-sqlite3.git
cd node-sqlite3
./configure
make
I installed npm with: curl -k https://npmjs.org/install.sh | sudo sh
and installed node-gyp with npm: sudo npm install -g node-gyp
After node-sqlite3 configure-d and make-d okay, I tried to install with npm, I get this:
npm install sqlite3
npm WARN install Refusing to install sqlite3 as a dependency of itself
When I researched this error, I found this question: npm install sqlite3 error so I tried:
node-waf clean || true; node-waf configure build
but got this error:
/usr/local/bin/../lib/node/wafadmin/Utils.py:136: DeprecationWarning: the md5 module is deprecated; use hashlib instead
from md5 import md5
Waf: Please run waf from a directory containing a file named "wscript" or run distclean
/usr/local/bin/../lib/node/wafadmin/Utils.py:136: DeprecationWarning: the md5 module is deprecated; use hashlib instead
from md5 import md5
arg[0] directory does not contain a wscript file
When I tried to build orlandov/node-sqlite, I got it from git and then tried:
node-waf configure build
but I get this error:
/usr/local/bin/../lib/node/wafadmin/Utils.py:136: DeprecationWarning: the md5 module is
deprecated; use hashlib instead
from md5 import md5
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /nnmc/cvsbin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for program gcc or cc : cc
Checking for gcc : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
'configure' finished successfully (0.070s)
Waf: Entering directory `/U1/dorothyy/project_node/node-sqlite/build'
/U1/dorothyy/project_node/node-sqlite/deps/mpool-2.1.0
make: Nothing to be done for `all'.
Waf: Leaving directory `/U1/dorothyy/project_node/node-sqlite/build'
Traceback (most recent call last):
File "/usr/local/bin/node-waf", line 16, in <module>
Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare
prepare_impl(t, cwd, ver, wafdir)
File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_impl
main()
File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 188, in main
fun(ctx)
File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 386, in build
return build_impl(bld)
File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 405, in build_impl
bld.compile()
File "/usr/local/bin/../lib/node/wafadmin/Build.py", line 255, in compile
self.flush()
File "/usr/local/bin/../lib/node/wafadmin/Build.py", line 717, in flush
tg.post()
File "/usr/local/bin/../lib/node/wafadmin/TaskGen.py", line 219, in post
self.apply()
File "/usr/local/bin/../lib/node/wafadmin/TaskGen.py", line 206, in apply
v()
File "/usr/local/bin/../lib/node/wafadmin/TaskGen.py", line 464, in apply_core
node = find_resource(filename)
File "/usr/local/bin/../lib/node/wafadmin/Node.py", line 183, in find_resource
st = Utils.h_file(path)
AttributeError: 'module' object has no attribute 'h_file'
I cannot use grumdrig/node-sqlite because it does not support asynchronous access.
Thank you for any suggestions.
I got this error when my app had the same name as one of the packages I was (npm) installing. I was just doing some practise and had not thought I needed a unique name for the project...
Just change the name
in your package.json
to something else and it should work.
You don't need to execute
npm install sqlite3
in node-sqlite3 folder. By executing this command you trying to install sqlite3 as dependency of sqlite3 (you already have it).
There are two ways to install sqlite3:
First:
In your project folder execute
npm install sqlite3
You dont need to clone git project before it. Don't need to configure and make it manually. Just execute this command in your project folder where you want to use sqlite3 module. You should see folder node_modules/sqlite3 in your project folder after npm finish. Now you can use it in your project by require:
var sqlite3 = require('sqlite3');
Second:
Use this way only if npm install fails. (Paranormal).
Execute:
git clone git://github.com/developmentseed/node-sqlite3.git
cd node-sqlite3
./configure
make
Ok. Now sqlite3 half-ready to use. We need to install dependencies. Execute:
npm install
Attention: npm install without other parameters. This command use package.json in your sqlite3 folder to install dependencies.
After npm finish you can use sqlite3 module in your project.
Just leave the directory of the module you want to install and try to install it again. This worked for me. So:
cd ..
npm install sqlite3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With