npm ERR! asyncWrite is not a function

2020-05-29 12:58发布

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! /home/developer/.npm/_logs/2018-05-30T05_42_20_569Z-debug.log

.log data

/home/developer/.npm/_logs/2018-05-30T05_42_20_569Z-debug.log0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'firebase-tools' ]
2 info using npm@6.1.0
3 info using node@v10.3.0
4 verbose npm-session 4ca1ad6ed9bde18f
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 verbose stack TypeError: asyncWrite is not a function
7 verbose stack     at onwrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:480:7)
7 verbose stack     at WritableState.onwrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:180:5)
7 verbose stack     at WriteStream.to [as _worker] (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/cache.js:154:13)
7 verbose stack     at WriteStream._write (/usr/local/lib/node_modules/npm/node_modules/mississippi/node_modules/flush-write-stream/index.js:35:13)
7 verbose stack     at doWrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:428:64)
7 verbose stack     at writeOrBuffer (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:417:5)
7 verbose stack     at WriteStream.Writable.write (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:334:11)
7 verbose stack     at WriteStream.to [as _worker] (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/cache.js:171:25)
7 verbose stack     at WriteStream._write (/usr/local/lib/node_modules/npm/node_modules/mississippi/node_modules/flush-write-stream/index.js:35:13)
7 verbose stack     at doWrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:428:64)
7 verbose stack     at writeOrBuffer (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:417:5)
7 verbose stack     at WriteStream.Writable.write (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:334:11)
7 verbose stack     at WriteStream.to [as _worker] (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/cache.js:182:19)
7 verbose stack     at WriteStream._write (/usr/local/lib/node_modules/npm/node_modules/mississippi/node_modules/flush-write-stream/index.js:35:13)
7 verbose stack     at doWrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:428:64)
7 verbose stack     at writeOrBuffer (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:417:5)
8 verbose cwd /home/developer/Development/host2
9 verbose Linux 4.15.0-22-generic
10 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "firebase-tools"
11 verbose node v10.3.0
12 verbose npm  v6.1.0
13 error asyncWrite is not a function
14 verbose exit [ 1, true ]



npm -v :6.1.0
node -v :v10.3.0
os :Ubuntu 18.04 LTS
graphics :AMD® Juniper
processor:Intel® Core™ i7 CPU 960 @ 3.20GHz × 8
os type : 64-bit

16条回答
The star\"
2楼-- · 2020-05-29 13:32

that's because, when I'm writing this answer, node 10 is not quite stable. So better stick to node 8. for that you can downgrade to 8.11.3 using

sudo n 8.11.3

then you can easily install npm modules.

查看更多
劳资没心,怎么记你
3楼-- · 2020-05-29 13:34

I've fixed this by:

  1. Cleaning cache npm cache clean -f
  2. Upgrading node to latest version: nvm install <version>
  3. Upgrading npm to latest version: npm i -g npm
  4. Removing dependencies: rm -rf node_modules
  5. Installing dependencies again: npm install
查看更多
smile是对你的礼貌
4楼-- · 2020-05-29 13:35

The solution mentioned by DKebler did not work for me either, still got the same error and debug log.

I had also to downgrade.

Command Lines

sudo npm cache clean -f

sudo n 8.11.2
查看更多
你好瞎i
5楼-- · 2020-05-29 13:36

Solution for windows platform

  1. Uninstall Node
  2. Delete folder from programfiles if exist (C:\Program Files\nodejs)
  3. Delete npm's data folder: C:\Users{Your uername}\AppData\Roaming\nmp

Install node Again(use different installation folder like "C:\Program Files\nodejs-2")

Root cause is node and nvm installed in same installation folder.

查看更多
神经病院院长
6楼-- · 2020-05-29 13:38

Usually, the best way for fix it is:

rm -R /usr/local/lib/node_modules/npm and reinstall Node.js.

My recommendation is install every time Node.js from source code (yes, running make && make install). If you using Debian/Ubuntu, remember first install build-essential

$ sudo apt-get install build-essential
$ wget https://nodejs.org/dist/v10.6.0/node-v10.6.0.tar.gz
$ tar -zxvf node-v10.6.0.tar.gz
$ cd node-v10.6.0
$ make
$ sudo make install

Regards.

查看更多
Anthone
7楼-- · 2020-05-29 13:41

Just ran into this error myself when trying to install express via npm. My simple solution was to downgrade node to the stable release. If you have "n", the node version manager, it can be done so with the command:

n stable

Hopefully this helps! I highly recommend "n" if you haven't used it before. It makes life easier :)

查看更多
登录 后发表回答