Refusing to install sqlite3 as a dependency of itself


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://
cd node-sqlite3

I installed npm with: curl -k | 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/ 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/ 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/ 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'
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/", line 145, in prepare
prepare_impl(t, cwd, ver, wafdir)
File "/usr/local/bin/../lib/node/wafadmin/", line 135, in prepare_impl
File "/usr/local/bin/../lib/node/wafadmin/", line 188, in main
File "/usr/local/bin/../lib/node/wafadmin/", line 386, in build
return build_impl(bld)
File "/usr/local/bin/../lib/node/wafadmin/", line 405, in build_impl
File "/usr/local/bin/../lib/node/wafadmin/", line 255, in compile
File "/usr/local/bin/../lib/node/wafadmin/", line 717, in flush
File "/usr/local/bin/../lib/node/wafadmin/", line 219, in post
File "/usr/local/bin/../lib/node/wafadmin/", line 206, in apply
File "/usr/local/bin/../lib/node/wafadmin/", line 464, in apply_core
node = find_resource(filename)
File "/usr/local/bin/../lib/node/wafadmin/", 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.

5/23/2017 12:26:27 PM

Accepted Answer

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:


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');


Use this way only if npm install fails. (Paranormal).

  1. Go to your project folder.
  2. Create folder node_modules if not exists.
  3. Execute:

    git clone git://
    cd node-sqlite3
  4. 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.

8/13/2012 8:14:59 PM

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow