npm install -g firebase-tools 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!
n was updated in v2.1.12 to address this issue. Previously, the new npm was just being copied over the existing folder. This could cause problems when the layout of the node_modules changed as happened in node 10.
Deleting npm and reinstalling will fix the npm issue. Upgrading n
will prevent the issue from happening again when switching versions using n
.
https://github.com/tj/n/issues/508#issuecomment-423933394
e.g.
$ rm /usr/local/bin/node
$ rm -rf /usr/local/lib/node_modules/npm
$ n latest
$ npm install -g n
/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
+ n@2.1.12
updated 1 package in 0.466s
I am guessing it is an incompatibility between npm v5 and node v10. To solve this I downgraded node to v9, upgraded npm to v6, then upgraded node to v10:
n 9.10.1
npm i -g npm
n stable
Use sudo when switching node version with n
example sudo n 10.4.1
I was able to fix the issue by forcing readable-stream@2.3.0.