f8app npm error的解决

f8app npm error的解决

f8app在安装Node.Js依赖的时候报错如下

YandeMacBook-Pro:f8app yangao$ npm install
npm ERR! tar.unpack unzip error /var/folders/kl/qx6dvh913r34kb5wlrm8_cb80000gn/T/npm-2885-1563c7d3/registry.npmjs.org/babel-generator/-/babel-generator-6.10.2.tgz
npm ERR! tar.unpack untar error /var/folders/kl/qx6dvh913r34kb5wlrm8_cb80000gn/T/npm-2885-1563c7d3/registry.npmjs.org/babel-generator/-/babel-generator-6.10.2.tgz
npm ERR! tar.unpack unzip error /var/folders/kl/qx6dvh913r34kb5wlrm8_cb80000gn/T/npm-2885-1563c7d3/registry.npmjs.org/art/-/art-0.10.1.tgz
npm ERR! tar.unpack unzip error /var/folders/kl/qx6dvh913r34kb5wlrm8_cb80000gn/T/npm-2885-1563c7d3/registry.npmjs.org/promise/-/promise-6.1.0.tgz
npm ERR! tar.unpack unzip error /var/folders/kl/qx6dvh913r34kb5wlrm8_cb80000gn/T/npm-2885-1563c7d3/registry.npmjs.org/ejs/-/ejs-2.4.2.tgz
npm ERR! tar.unpack untar error /var/folders/kl/qx6dvh913r34kb5wlrm8_cb80000gn/T/npm-2885-1563c7d3/registry.npmjs.org/ejs/-/ejs-2.4.2.tgz
npm ERR! tar.unpack unzip error /var/folders/kl/qx6dvh913r34kb5wlrm8_cb80000gn/T/npm-2885-1563c7d3/registry.npmjs.org/is/-/is-3.1.0.tgz
npm ERR! tar.unpack untar error /var/folders/kl/qx6dvh913r34kb5wlrm8_cb80000gn/T/npm-2885-1563c7d3/registry.npmjs.org/is/-/is-3.1.0.tgz
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/Cellar/node/6.3.1/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.3.1
npm ERR! npm  v3.10.3
npm ERR! code Z_BUF_ERROR
npm ERR! errno -5

npm ERR! unexpected end of file
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/yangao/Coding/ReactNative/f8app/npm-debug.log

关键点是unexpected end of file。出现unexpected end of XX,一般是npm install过程中下载错误或者本地cache有问题。

  1. 首先排除网络问题,本例子中发生错误的是本地文件无法解压。可能是下载出错,但用package.json里面的发现都是可下载的。
  2. 查看路径下的包,发现有损坏,清空npm cache
npm cache clean

清理后发现可以install成功。

你可能感兴趣的:(技术笔记)