Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

npm download not working in unix with NODE_USE_UV=1 #1513

Closed
ry opened this issue Aug 12, 2011 · 11 comments
Closed

npm download not working in unix with NODE_USE_UV=1 #1513

ry opened this issue Aug 12, 2011 · 11 comments
Labels
Milestone

Comments

@ry
Copy link

ry commented Aug 12, 2011

e.g. npm install socket.io failes

cc @isaacs

@ghost ghost assigned bnoordhuis Aug 12, 2011
@bnoordhuis
Copy link
Member

Possibly related to #1531.

@ghost ghost assigned ry Aug 22, 2011
@mikeal
Copy link

mikeal commented Aug 22, 2011

@isaacs fixed this on the npm side

@isaacs
Copy link

isaacs commented Aug 22, 2011

I'm pretty sure that this issue was a result of 7e32ef571d15bf40723725c0c0a86be7a16d7cfa. Fixed both in npm and in node.

@isaacs isaacs closed this as completed Aug 22, 2011
@ry ry reopened this Aug 22, 2011
@ry
Copy link
Author

ry commented Aug 22, 2011

@isaacs, that hasn't been landed yet. what's the fix in npm? npm should not conform to node's bugs as we switch backends.

@mikeal
Copy link

mikeal commented Aug 22, 2011

@isaacs you know what, i was thinking of that host header issue that we fixed in the last release, nevermind.

@ry
Copy link
Author

ry commented Aug 22, 2011

#1531 did not fix.

@mikeal
Copy link

mikeal commented Aug 22, 2011

what is the actual exception for this npm issue?

@isaacs
Copy link

isaacs commented Aug 22, 2011

Ah, weird. On node 0.5.3, running NODE_USE_UV=1 npm install socket.io -dd doesn't trigger any output at all (as if process.stdout.write is somehow broken?), and the resulting npm-debug.log file shows:

ERR! TypeError: Cannot call method 'readStart' of null
ERR!     at Socket.resume (net_uv.js:163:16)
ERR!     at Socket.<anonymous> (util.js:423:16)
ERR!     at Socket.emit (events.js:64:17)
ERR!     at Object.afterWrite [as oncomplete] (net_uv.js:381:10)
ERR! Report this *entire* log at:
ERR!     <http://github.com/isaacs/npm/issues>
ERR! or email it to:
ERR!     <npm-@googlegroups.com>
ERR! 
ERR! System Darwin 10.8.0
ERR! command "node" "/Users/isaacs/local/bin/npm" "install" "socket.io" "-ddd"
ERR! cwd /Users/isaacs/private/writing/node-blog
ERR! node -v v0.5.3
ERR! npm -v 1.0.26

@ry
Copy link
Author

ry commented Aug 23, 2011

Found the error. NPM uses new net.Stream(fd).

We need to add compatibility for this API. In the meantime I've changed Node to throw when people attempt this constructor.

e3413f0

Note that NPM has a

  • try { .. } catch() {} around log statements,
  • a buffered log which calls itself recursively,
  • and an uncaughtException handler which enters the log
    these combine in horrible ways to mask this new error that I've added.

Added #1573 for constructor on fd support.

@isaacs
Copy link

isaacs commented Aug 23, 2011

try { .. } catch() {} around log statements,

Not around log statements, around the creation of the stream. If it fails, no stream gets created, which is why there's zero output at all. The npm-debug.log file still showed the failure, though.

Updated to use process.stdout and process.stderr if the supplied FD matches theirs. To still trigger the error, do this:

# expected, pre-uv:
$ npm install socket.io --outfd 3 3>out.txt ; cat out.txt
socket.io@0.7.9 ./node_modules/socket.io 
├── policyfile@0.0.4
├── redis@0.6.6
└── socket.io-client@0.7.9

# actual: no output
$ NODE_USE_UV=1 npm install socket.io --outfd 3 3>out.txt ; cat out.txt

$ ls -laF out.txt
-rw-r--r--  1 isaacs  staff  0 Aug 23 09:25 out.txt

a buffered log which calls itself recursively,

It only buffers until the config files are read and processed, since before that time, it doesn't know which logs you want shown, and I write a few verbose logs saying which config files are getting loaded. Updated to remove the uncaughtException handler and throw if there's an error prior to ini resolution.

  • and an uncaughtException handler which enters the log

It seems that removing an uncaughtException handler doesn't put node back in a state where throws are logged. So, if there's an early termination where it's not clear that the log will work (ie, exit prior to resolving the configs) then it'll write to console.error, and exit.

@ry
Copy link
Author

ry commented Sep 5, 2011

downloads working as of ef523e5

@ry ry closed this as completed Sep 5, 2011
lyonplus pushed a commit to lyonplus/node that referenced this issue May 22, 2015
PR-URL: nodejs/node#1532

Notable Changes:

* crypto: significantly reduced memory usage for TLS (Fedor Indutny & Сковорода
  Никита Андреевич) nodejs#1529
* net: socket.connect() now accepts a 'lookup' option for a custom DNS
  resolution mechanism, defaults to dns.lookup() (Evan Lucas) nodejs#1505
* npm: Upgrade npm to 2.9.0. See the v2.8.4 and v2.9.0 release notes for
  details. Notable items:
  - Add support for default author field to make npm init -y work without
    user-input (@othiym23) npm/npm/d8eee6cf9d
  - Include local modules in npm outdated and npm update (@ArnaudRinquin)
    npm/npm#7426
  - The prefix used before the version number on npm version is now configurable
    via tag-version-prefix (@kkragenbrink) npm/npm#8014
* os: os.tmpdir() is now cross-platform consistent and will no longer returns a
  path with a trailling slash on any platform (Christian Tellnes) nodejs#747
* process:
  - process.nextTick() performance has been improved by between 2-42% across the
    benchmark suite, notable because this is heavily used across core (Brian White) nodejs#1548
  - New process.geteuid(), process.seteuid(id), process.getegid() and
    process.setegid(id) methods allow you to get and set effective UID and GID
    of the process (Evan Lucas) nodejs#1536
* repl:
  - REPL history can be persisted across sessions if the NODE_REPL_HISTORY_FILE
    environment variable is set to a user accessible file,
    NODE_REPL_HISTORY_SIZE can set the maximum history size and defaults to 1000
    (Chris Dickinson) nodejs#1513
  - The REPL can be placed in to one of three modes using the NODE_REPL_MODE
    environment variable: sloppy, strict or magic (default); the new magic mode
    will automatically run "strict mode only" statements in strict mode
    (Chris Dickinson) nodejs#1513
* smalloc: the 'smalloc' module has been deprecated due to changes coming in V8
  4.4 that will render it unusable
* util: add Promise, Map and Set inspection support (Christopher Monsanto) nodejs#1471
* V8: upgrade to 4.2.77.18, see the ChangeLog for full details. Notable items:
  - Classes have moved out of staging; the class keyword is now usable in strict
    mode without flags
  - Object literal enhancements have moved out of staging; shorthand method and
    property syntax is now usable ({ method() { }, property })
  - Rest parameters (function(...args) {}) are implemented in staging behind the
    --harmony-rest-parameters flag
  - Computed property names ({['foo'+'bar']:'bam'}) are implemented in staging
    behind the --harmony-computed-property-names flag
  - Unicode escapes ('\u{xxxx}') are implemented in staging behind the
    --harmony_unicode flag and the --harmony_unicode_regexps flag for use in
    regular expressions
* Windows:
  - Random process termination on Windows fixed (Fedor Indutny) nodejs#1512 / nodejs#1563
  - The delay-load hook introduced to fix issues with process naming (iojs.exe /
    node.exe) has been made opt-out for native add-ons. Native add-ons should
    include 'win_delay_load_hook': 'false' in their binding.gyp to disable this
    feature if they experience problems . (Bert Belder) nodejs#1433
* Governance:
  - Rod Vagg (@rvagg) was added to the Technical Committee (TC)
  - Jeremiah Senkpiel (@Fishrock123) was added to the Technical Committee (TC)
@ry ry removed their assignment Aug 31, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants