my8bird/node-leveldb — Issue #11: Current NPM module 0.5.3 won't build, looking for /home/nathan/
Author: justmoon
Created: 2012-02-12 14:59:38+00:00
State: open

```
moon@clymene:/var/www/node-bitcoin-p2p$ sudo npm install leveldb
npm http GET https://registry.npmjs.org/leveldb
npm http 304 https://registry.npmjs.org/leveldb
npm http GET https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/coffee-script

> leveldb@0.5.3 install /atlas/www/node-bitcoin-p2p/node_modules/leveldb
> node-waf configure build

Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for program gcc or cc : /usr/bin/gcc
Checking for gcc : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
'configure' finished successfully (0.058s)
Waf: Entering directory `/home/nathan/src/node-leveldb/build'
Waf: Leaving directory `/home/nathan/src/node-leveldb/build'
cp: cannot stat `/home/nathan/src/node-leveldb/build/Release/leveldb.node': No such file or directory
'build' finished successfully (0.007s)

> leveldb@0.5.3 postinstall /atlas/www/node-bitcoin-p2p/node_modules/leveldb
> ./node_modules/coffee-script/bin/coffee -b -c -o lib/ src

leveldb@0.5.3 ./node_modules/leveldb
└── coffee-script@1.2.0
```

The fix is to delete the build directory:

```

moon@clymene:/var/www/node-bitcoin-p2p$ sudo rm -r node_modules/leveldb/build/
moon@clymene:/var/www/node-bitcoin-p2p$ cd node_modules/leveldb/
moon@clymene:/var/www/node-bitcoin-p2p/node_modules/leveldb$ sudo node-waf configure build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for program gcc or cc : /usr/bin/gcc
Checking for gcc : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
'configure' finished successfully (0.042s)
Waf: Entering directory `/atlas/www/node-bitcoin-p2p/node_modules/leveldb/build'
[ 1/47] cxx: deps/snappy/snappy.cc -> build/Release/deps/snappy/snappy_1.o
[ 2/47] cxx: deps/snappy/snappy-sinksource.cc -> build/Release/deps/snappy/snappy-sinksource_1.o
[...etc...]
```

You can try changing the `.npmignore` entry from `build` to `build/`, but I've found that even then NPM is pretty wonky about randomly including stuff. My advice is to just make a habit of `rm -r build` before `npm publish`.