I'm trying to install truffle, an ethereum development framework, via npm, running sudo npm i -D -g truffle. Unfortunately I'm getting the following error:

npm ERR! write after end

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-03-04T06_53_40_814Z-debug.log

I have no experience with npm whatsoever so any help would be much appreciated.

Debug log extract

1401 verbose stack Error [ERR_STREAM_WRITE_AFTER_END]: write after end
1401 verbose stack     at writeAfterEnd (_stream_writable.js:237:12)
1401 verbose stack     at PassThrough.Writable.write (_stream_writable.js:287:5)
1401 verbose stack     at PassThrough.Writable.end (_stream_writable.js:572:10)
1401 verbose stack     at ReadEntry.entry.on (/usr/lib/node_modules/npm/node_modules/pacote/lib/extract-stream.js:19:41)
1401 verbose stack     at ReadEntry.emit (events.js:132:15)
1401 verbose stack     at ReadEntry.emit (/usr/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:287:25)
1401 verbose stack     at ReadEntry.[maybeEmitEnd] (/usr/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:240:12)
1401 verbose stack     at ReadEntry.end (/usr/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:153:27)
1401 verbose stack     at Unpack.[consumeBody] (/usr/lib/node_modules/npm/node_modules/tar/lib/parse.js:210:13)
1401 verbose stack     at Unpack.[consumeChunkSub] (/usr/lib/node_modules/npm/node_modules/tar/lib/parse.js:391:40)
1401 verbose stack     at Unpack.[consumeChunk] (/usr/lib/node_modules/npm/node_modules/tar/lib/parse.js:360:30)
1401 verbose stack     at Unzip.(anonymous function).on.chunk (/usr/lib/node_modules/npm/node_modules/tar/lib/parse.js:291:59)
1401 verbose stack     at Unzip.emit (events.js:127:13)
1401 verbose stack     at Unzip.emit (/usr/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:287:25)
1401 verbose stack     at Unzip.write (/usr/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:90:17)
1401 verbose stack     at Unzip.write (/usr/lib/node_modules/npm/node_modules/tar/node_modules/minizlib/index.js:284:29)
1402 verbose cwd /home/someonw/somewhere
1403 verbose Linux 4.15.6-1-ARCH
1404 verbose argv "/usr/bin/node" "/usr/bin/npm" "i" "-D" "-g" "truffle"
1405 verbose node v9.7.1
1406 verbose npm  v5.7.1
1408 error write after end
1409 verbose exit [ 1, true ]

Some general info

$ uname -a
Linux someone 4.15.6-1-ARCH #1 SMP PREEMPT Sun Feb 25 12:53:23 UTC 2018 x86_64 GNU/Linux

$ npm --version
  • @jasonwryan, out of interest, what was the reason for removing the arch-linux tag?
    – pandita
    Mar 5, 2018 at 10:23
  • You aren't using Arch packages or it's package manager, this is all Node/NPM...
    – jasonwryan
    Mar 5, 2018 at 15:11
  • Thanks for the clarification, @jasonwryan. The reason I added it that I installed npm/nodejs via the arch repositories, and of course because I'm running arch. So I'd argue that there might be a possibility that this is something other arch users might have come across and prehaps solved. You'd think the OS someone is using could have an impact on the problem e.g. via dependencies. Can we agree to add it now?
    – pandita
    Mar 6, 2018 at 9:04
  • 1
    – Matt
    Mar 7, 2018 at 8:17

1 Answer 1


As per @Matt's link, this apparently was a bug. I saw an update in the arch repositories available today, after which truffle installed fine.

Not the answer you're looking for? Browse other questions tagged or ask your own question.