I’m trying to package my Node.js application for deployment on a production server that doesn’t have npm installed. I’ve used npm to download all required dependencies into a local node_modules directory based on my package.json configuration.
Everything seems to work fine during the setup process, but when I try to execute the application on the target server, I get an error saying Cannot find module '../build/Release/contextify'.
Looking into this issue, I found that the contextify module at node_modules/.npm/contextify/0.0.4/package/lib/contextify.js is trying to load this specific file, but the node_modules/.npm/contextify/0.0.4/package/build folder doesn’t contain any Release subdirectory.
I thought maybe the module wasn’t properly compiled, so I went back to my development environment and executed npm install again. The installation process seemed to work and showed contextify being built:
$ npm install
> [email protected] preinstall /my/project/path/node_modules/contextify
> node-waf clean || true; node-waf configure build
'clean' finished successfully (0.012s)
Setting srcdir to: /my/project/path/node_modules/.npm/contextify/0.0.4/package
Setting blddir to: /my/project/path/node_modules/.npm/contextify/0.0.4/package/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 node path: not found
Checking for node prefix: ok /usr/local/Cellar/node/0.4.5
'configure' finished successfully (0.041s)
Waf: Entering directory `/my/project/path/node_modules/.npm/contextify/0.0.4/package/build`
[1/2] cxx: src/contextify.cc -> build/default/src/contextify_1.o
[2/2] cxx_link: build/default/src/contextify_1.o -> build/default/contextify.node
Waf: Leaving directory `/my/project/path/node_modules/.npm/contextify/0.0.4/package/build`
'build' finished successfully (0.351s)
However, even after this apparently successful build process, the package/build directory still lacks the Release folder that the module is looking for.
Is this build failure related to the “node path: not found” message I’m seeing during configuration? I attempted setting export NODE_PATH but that didn’t resolve the issue. What could be causing contextify to not build properly, and how can I fix this deployment problem?