dominictarr / npmd

MIT License
450 stars 37 forks source link

process.getuid() not available on Windows #83

Closed peacememories closed 9 years ago

peacememories commented 9 years ago

Following a run-in with one of node's most annoying problems - dependency tree depth exploding some Windows software - I found this project and tried it in hopes of alleviating the problem.

Trying to run it, though, it errors in index.js of npmd-install, because it can't call process.getuid().

I tried hardcoding the uid and gid values there, but now npmd just hangs on install.

dominictarr commented 9 years ago

okay well I don't have a windows computer, but if you want to lend me a hand debugging this we can fix it. the purpose of the getuid is to detect whether it's being run as root or not... I guess on windows that doesn't really make sense and it would be best to just treat it as a normal installation?

peacememories commented 9 years ago

I'd be happy to provide debug output if you ask me for some (I'm not stable enough in the node ecosystem to just be able to give you everything you need in advance, sorry).

For now I've been trying to narrow down the problem. I've moved from npmd to working with the npmd-resolve and npmd-install modules directly. Interestingly, as soon as I remove the uid references there, i can install packages, BUT; once installed, they seem to have no permissions set, so running npmd-resolve again fails with permission errors.

events.js:72
        throw er; // Unhandled 'error' event
              ^
OpenError: EPERM, open 'C:\Users\gabriel\.npmd\db\2.medea.data'
    at C:\Users\gabriel\AppData\Roaming\npm\node_modules\npmd-resolve\node_modul
es\npmd-cache\node_modules\levelup\lib\levelup.js:114:34
    at C:\Users\gabriel\AppData\Roaming\npm\node_modules\npmd-resolve\node_modul
es\npmd-cache\node_modules\medeadown\medeadown.js:32:16
    at C:\Users\gabriel\AppData\Roaming\npm\node_modules\npmd-resolve\node_modul
es\npmd-cache\node_modules\medeadown\node_modules\medea\node_modules\async\lib\a
sync.js:254:17
    at C:\Users\gabriel\AppData\Roaming\npm\node_modules\npmd-resolve\node_modul
es\npmd-cache\node_modules\medeadown\node_modules\medea\node_modules\async\lib\a
sync.js:151:21
    at C:\Users\gabriel\AppData\Roaming\npm\node_modules\npmd-resolve\node_modul
es\npmd-cache\node_modules\medeadown\node_modules\medea\node_modules\async\lib\a
sync.js:251:21
    at C:\Users\gabriel\AppData\Roaming\npm\node_modules\npmd-resolve\node_modul
es\npmd-cache\node_modules\medeadown\node_modules\medea\node_modules\async\lib\a
sync.js:615:34
    at C:\Users\gabriel\AppData\Roaming\npm\node_modules\npmd-resolve\node_modul
es\npmd-cache\node_modules\medeadown\node_modules\medea\medea.js:149:18
    at done (C:\Users\gabriel\AppData\Roaming\npm\node_modules\npmd-resolve\node
_modules\npmd-cache\node_modules\medeadown\node_modules\medea\node_modules\async
\lib\async.js:129:15)
    at C:\Users\gabriel\AppData\Roaming\npm\node_modules\npmd-resolve\node_modul
es\npmd-cache\node_modules\medeadown\node_modules\medea\node_modules\async\lib\a
sync.js:32:16
    at C:\Users\gabriel\AppData\Roaming\npm\node_modules\npmd-resolve\node_modul
es\npmd-cache\node_modules\medeadown\node_modules\medea\medea.js:175:18

undefined:0

^
SyntaxError: Unexpected end of input
    at Object.parse (native)
    at Socket.<anonymous> (C:\Users\gabriel\AppData\Roaming\npm\node_modules\npm
d-install\index.js:208:21)
    at Socket.emit (events.js:117:20)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:442:13)
peacememories commented 9 years ago

Also getting a permission error for medea.lock if it doesn't exist. Running npmd-resolve, piping out into a file and then piping into npmd-install works. Could it be that they both lock on the same databases?

dominictarr commented 9 years ago

Okay try installing the latest npmd-install. It now checks whether getuid is available and if not, it just doesn't set anything, which hopefully lets that thing fallback to defaults. Otherwise, this might be a problem with tar-fs

@peacememories yeah, they are both locking the same database,

dominictarr commented 9 years ago

sorry that is 5.1.7

maybe there is a way around locking the database if one could just open it in readonly mode.

peacememories commented 9 years ago

Package database still says the newest version is 5.1.6, but the weirder thing is that the github repo says it's on 5.1.5 (also, there's apparently a pull request for exactly what we're after here^^)

dominictarr commented 9 years ago

sorry I forgot to hit publish, try again now.

peacememories commented 9 years ago

Seems to work. marking this closed. Thanks for the help =)

dominictarr commented 9 years ago

cool no problem!