Skip to content Skip to sidebar Skip to footer

Node_path Has No Effect On Module.paths Or Finding Modules

I'm trying to get node to recognize my grunt node module that is installed in a non-typical directory for a build environment, but updating NODE_PATH is having no effect: $ env | g

Solution 1:

On Unix (not on Windows), if the node binary should be treated securely, certain entries stemming from unsecure environment variables are not included in the module.paths array.

More precisely, if the node binary has set-user-ID or set-group-ID or has capabilities, the entries stemming from the environment variables HOME and NODE_PATH will not be included in the module.paths array. These are the following three paths:

$NODE_MODULES$HOME/.node_modules
$HOME/.node_libraries

So you either can put the modules found in foo somewhere in /mnt/colbblailx.old/home/colbblai/src/node_modules (or similar) or you switch to a node binary not running with neither setuid nor capabilities.

See my answer to this question for some more details.

Post a Comment for "Node_path Has No Effect On Module.paths Or Finding Modules"