isaacs/npm — Issue #2080: Installing pkg with many dependencies as root fails with graceful-fs 1.1.4
Author: afbobak
Created: 2012-01-23 22:00:11+00:00
State: open

Upgrading to graceful-fs 1.1.4 breaks installing packages as root on Linux:

verbose from cache /root/.npm/colors/0.6.0-1/package/package.json
verbose chmod /root/.npm/colors/0.6.0-1/package.tgz 644
verbose chown [ '/root/.npm/colors/0.6.0-1/package.tgz', 0, 0 ]
ERR! TypeError: Cannot call method 'call' of undefined
ERR! at Object.lchown (/usr/lib/nodejs/npm/node_modules/graceful-fs/graceful-fs.js:228:17)
ERR! at setProps (/usr/lib/nodejs/npm/node_modules/fstream/lib/writer.js:240:19)
ERR! at Object.oncomplete (/usr/lib/nodejs/npm/node_modules/fstream/lib/writer.js:206:7)
ERR! You may report this log at:
ERR!
ERR! or email it to:
ERR!
ERR!
ERR! System Linux 2.6.32-37-generic-pae
ERR! command "node" "/usr/bin/npm" "install" "--unsafe-perm" "-g" "osares.app"
ERR! cwd /osares/scripts
ERR! node -v v0.6.8
ERR! npm -v 1.1.0-2
ERR! type non_object_property_call
ERR! arguments [ 'call', undefined ]
ERR! message Cannot call method 'call' of undefined
verbose exit [ 1, true ]

Commenting out lines 218 to EOF in graceful-fs.js fixes the issue with root (but obviously introduces https://github.com/isaacs/node-graceful-fs/issues/4 again)