npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

asyncWrite is not a function at node@10.3.0 and npm@6.1.0

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)


My sentiments exactly.


getting the exact same issue - any help would be appreciated


I’m getting the same issue node 10.4 npm 6.1.
I used n to manage the node versions in my mac, this issue start raising after I installed latest node version n latest


This appears to be fixed using node@10.4.0 and npm@6.1.0.

[app git:(develop)] ✔  node -v
v10.4.0
[app git:(develop)] ✔  npm -v
6.1.0
[app git:(develop)] ✔  npm install
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.

audited 20323 packages in 8.246s
found 17 moderate severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details


I’m experiencing the same thing after an n install 10.3.0

The first install appeared to crash after the asyncWrite failed, the second onward appears to chug along and hits other errors as well, including cache misses and a pna.nextTick is not a function

$ lsb_release -a
|Distributor ID:|Trisquel|
|---|---|
|Description:|Trisquel GNU/Linux 8.0, Flidas|
|Release:|8.0|
|Codename:|flidas|
$ node --version
v10.3.0
$ npm --version
6.1.0
$ npm install -g npm
npm ERR! asyncWrite is not a function
npm ERR! pna.nextTick is not a function

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/retrohacker/.npm/_logs/2018-06-05T19_53_43_635Z-debug.log
$ npm install
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
Unhandled rejection Error: No cache entry for pacote:packed-dir: found in /home/retrohacker/.npm/_cacache
    at index.find.then.entry (/home/retrohacker/n/lib/node_modules/npm/node_modules/cacache/get.js:83:18)
    at tryCatcher (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:638:18)
    at Promise._resolveCallback (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:432:57)
    at Promise._settlePromiseFromHandler (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:524:17)
    at Promise._settlePromise (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:696:18)

Unhandled rejection Error: No cache entry for pacote:packed-dir:git+ssh://git@github.com/[redacted].git#[redacted] found in /home/retrohacker/.npm/_cacache
    at index.find.then.entry (/home/retrohacker/n/lib/node_modules/npm/node_modules/cacache/get.js:83:18)
    at tryCatcher (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:638:18)
    at Promise._resolveCallback (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:432:57)
    at Promise._settlePromiseFromHandler (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:524:17)
    at Promise._settlePromise (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:696:18)

npm ERR! pna.nextTick is not a function
Unhandled rejection Error: No cache entry for pacote:packed-dir:git+ssh://git@github.com/[redacted].git#[redacted] found in /home/retrohacker/.npm/_cacache
    at index.find.then.entry (/home/retrohacker/n/lib/node_modules/npm/node_modules/cacache/get.js:83:18)
    at tryCatcher (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:638:18)
    at Promise._resolveCallback (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:432:57)
    at Promise._settlePromiseFromHandler (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:524:17)
    at Promise._settlePromise (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/retrohacker/n/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:696:18)

[CTRL-C INTERRUPT]


That is super weird.


Someone should also file an issue with readable-stream itself. Not sure how we can fix it npm-side yet.


I’ve opened an issue: https://github.com/tj/n/issues/510 (I can reproduce this with n.)


Well, I was using a node version manager instead of node through homebrew starting yesterday. I just dropped the version manager, went back to brew, and now the installs are working again.


I’m thinking this is a bug in how some version managers switch versions. Looking at the n source:

It’s activate code copies node to to its destination:

cp -fR “$dir/$subdir” $N_PREFIX

Because npm is now installed flatter than it was in previous version, this means that just copying like that is going to completely break your install. (Because w/o the remove, the older deeply nested versions will remain in place and you’ll get the wrong version of modules.) You need to remove the existing version before copying the new one in.

Folks who are seeing this issue, can you chime in with how you’re installing node, like, specifically which version manager, if you’re using one? (I use nvm, it doesn’t have this issue, fwiw.)


I’m using n, but I didn’t see this kind of errors in other previous version :thinking:


I’m gonna assume this was just a node bug, then. :slight_smile:


This one is super weird. I have no idea why y’all would be getting either a missing setImmediate or why process would be missing nextTick?

I think y’all can probably do some spelunking on this one. It’s definitely a bug in readable-stream, and possible process-nextick-args. Would be super helpful if someone with the repo looked into it.

I’m putting this back as unresolved in the meantime.


What I Wanted to Do

Just do npm install under node@10.3.0 and npm@6.1.0 (included by default)

What Happened Instead

The process log a npm ERR! asyncWrite is not a function all the time

Reproduction Steps

I think my code is not significant here, but I see the error doing a npm install after clone https://github.com/microlinkhq/www.

A complete npm debug stack trace here:

Extra information

If I switch to node@10.2.1 that has npm@5.6.0, it works like a charm.

Then the thing that was trying to do was update npm to the last version.

I can’t update npm from node@10.3.0 because the process throws another error related with stream:

npm ERR! pna.nextTick is not a function

so instead I downgrade to node@10.2.1 and install the last npm version available

The last npm version available is npm@6.1.0, that is curious because is the same that the npm version included in the node@10.3.0 bundle :thinking:

But this time it works fine. Looks like node@10.3.0 include a breaking change related with stream under the hood and the npm process doesn’t like it.

Details

❯ node --version
v10.3.0

❯ npm --version
6.1.0


I´ve still got this problem even with the latest versions of npm and node.

npm ERR! asyncWrite is not a function
npm ERR! pna.nextTick is not a function

How can i get around this?


Same issue for me. Node v10.4.0 / npm 6.1.0 via “n stable”

Downgrading to 9.11.1 did fix that thing


@kikobeats That’s not surprising: We started flattening the npm tree with 10.3.0, due to Node.js fixing a similar bug in the official installers this past February.


I’m getting this on 10.4 and 6.1. So, no, it’s not fixed with Node 10.4.


This has been fixed with a new release of n! =)