问题
My npm version: 6.4.1 node: 10.14.1 Ionic: 4.7.0 Cordova: 8.1.2 (Basically all of them are of the latest version)
When I try to install an ionic sidemenu at a specific location, an error occurs as such:
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on
reading Browserslist >3.0 config used in other tools.
npm ERR! code Z_BUF_ERROR
npm ERR! errno -5
npm ERR! zlib: unexpected end of file
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\15432\AppData\Roaming\npm-cache\_logs\2019-01-
12T00_54_51_838Z-debug.log
So I navigate to the log document and have a look on the end of the file:
1474 silly saveTree | +-- path-to-regexp@1.7.0
1474 silly saveTree | | `-- isarray@0.0.1
1474 silly saveTree | `-- serviceworker-cache-polyfill@4.0.0
1474 silly saveTree `-- zone.js@0.8.26
1475 verbose stack ZlibError: zlib: unexpected end of file
1475 verbose stack at Zlib.(anonymous function).onerror (C:\Program
Files\nodejs\node_modules\npm\node_modules\minizlib\index.js:131:21)
1475 verbose stack at Unzip.write (C:\Program
Files\nodejs\node_modules\npm\node_modules\minizlib\index.js:255:31)
1475 verbose stack at Unzip.flush (C:\Program
Files\nodejs\node_modules\npm\node_modules\minizlib\index.js:222:10)
1475 verbose stack at Unzip.end (C:\Program
Files\nodejs\node_modules\npm\node_modules\minizlib\index.js:229:10)
1475 verbose stack at Object.end (C:\Program
Files\nodejs\node_modules\npm\node_modules\tar\lib\parse.js:415:21)
1475 verbose stack at PassThrough.onend (_stream_readable.js:628:10)
1475 verbose stack at Object.onceWrapper (events.js:273:13)
1475 verbose stack at PassThrough.emit (events.js:187:15)
1475 verbose stack at endReadableNT (_stream_readable.js:1094:12)
1475 verbose stack at process._tickCallback
(internal/process/next_tick.js:63:19)
1476 verbose cwd D:\Coursera Doc\Ionic\conFusion
1477 verbose Windows_NT 10.0.17134
1478 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program
Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
1479 verbose node v10.14.1
1480 verbose npm v6.4.1
1481 error code Z_BUF_ERROR
1482 error errno -5
1483 error zlib: unexpected end of file
1484 verbose exit [ -5, true ]
I really have no idea what this means. So I try to type "npm install" and fix all the problems on the subfolder in which I create my sidemenu, and the same issue, as above, occurs. I hope that anyone can help me address this issue.
回答1:
This problem seems to be a DNS
issue when connecting to npm
registry.
Please check (https://status.npmjs.org/) first to see if all services are operational then clear your npm
cache.
Force clean
your npm cache
by doing:
npm cache clean --force
来源:https://stackoverflow.com/questions/54155947/installation-of-ionic-sidemenu-results-in-zliberror-zlib-unexpected-end-of-fi