FussyCat
FussyCat
2019-04-12 17:59
采纳率: 100%
浏览 3.2k

cnpm install执行时,出现Error [ERR_STREAM_WRITE_AFTER_END]

近期在安装vue的整套环境,结果在最后一步拉取依赖文件时出现了Error [ERR_STREAM_WRITE_AFTER_END]
下面我说明下安装步骤:
1. 安装nodejs,确定成功装了node和npm,两者的版本分别是v10.15.3和v6.4.1
2. 安装淘宝镜像(因为我直接访问国外服务器,是一直timeout的),确定cnpm成功安装
3. 安装electron,确定成功装了,版本是v4.1.4
4. 安装vue
5. 创建个脚手架(模板)
6. 拉取依赖文件到node_modules,好吧,到[54/58]时挂了,error了。

有谁有遇到过类似的问题吗,请各位大神指点啊。
以下是第6步操作出的error内容:

Error [ERR_STREAM_WRITE_AFTER_END]: write after end (writeStream "error") (writeStream "error"), GET https://cdn.npm.taobao.org/app-builder-bin/-/app-builder-bin-2.6.4.tgz 200 (connected: true, keepalive socket: false, agent status: {"createSocketCount":70,"createSocketErrorCount":0,"closeSocketCount":68,"errorSocketCount":0,"timeoutSocketCount":4,"requestCount":2463,"freeSockets":{},"sockets":{"cdn.npm.taobao.org:443::::::::true::::::::":2},"requests":{}}, socketHandledRequests: 1, socketHandledResponses: 1)
headers: {"server":"Tengine","content-type":"application/octet-stream","content-length":"34353169","connection":"keep-alive","date":"Wed, 10 Apr 2019 03:51:22 GMT","x-oss-request-id":"5CAD683AB1E9EC94B380C4A0","accept-ranges":"bytes","etag":"\"52CE328FB03990A3D297D6A5B1088B9E\"","last-modified":"Tue, 26 Feb 2019 07:41:51 GMT","x-oss-object-type":"Normal","x-oss-hash-crc64ecma":"34131763972269000","x-oss-storage-class":"Standard","cache-control":"max-age=0, s-maxage=86400","x-oss-server-time":"205","age":"172947","ali-swift-global-savetime":"1554868282","x-cache":"HIT TCP_MEM_HIT dirn:11:298812429 mlen:0","x-swift-savetime":"Wed, 10 Apr 2019 03:51:22 GMT","x-swift-cachetime":"194318","via":"cache2.cn1414[0,206-0,H], cache5.cn1414[1,0]","timing-allow-origin":"*","eagleid":"af061d9915550412296928509e"}
    at writeAfterEnd (_stream_writable.js:243:12)
    at WriteStream.Writable.write (_stream_writable.js:291:5)
    at IncomingMessage.ondata (_stream_readable.js:689:20)
    at IncomingMessage.emit (events.js:189:13)
    at addChunk (_stream_readable.js:284:12)
    at readableAddChunk (_stream_readable.js:265:11)
    at IncomingMessage.Readable.push (_stream_readable.js:220:10)
    at HTTPParser.parserOnBody (_http_common.js:122:22)
    at TLSSocket.socketOnData (_http_client.js:442:20)
    at TLSSocket.emit (events.js:189:13)

再附个截图:

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • FussyCat
    FussyCat 2019-04-19 19:44
    已采纳

    上述问题的解决方法是放弃了cnpm,使用npm:

    npm config set registry https://registry.npm.taobao.org
    

    几天前解决了这个问题了,但一直没有时间整理,现在把完整的安装流程捋了一遍,并整理到博文中,需要了解的可进我博文看,包含了安装流程和问题解决。
    需要的请见Electron-Vue之安装流程

    点赞 评论
  • caozhy

    检查防火墙是否禁用了443端口,检查网络还有dns,这个是超时网络连接错误。

    点赞 评论
  • beckcheng
    beckcheng 2019-04-14 11:11

    你的回答由于不符合指导分享传播知识的精神,已被删除,如有异议请联系客服(kufu@csdn.net),如何回答请参考:什么样的回答更容易被采纳(https://blog.csdn.net/askdevteam/article/details/82594676)

    点赞 评论

相关推荐