在sepFour这个项目里面,安装element-ui时出现了这样子的一个错误
F: 3 prcprcsepFour>npm i element-ui -S npm ERR! Unexpected end of JSON input while parsing near '...rma-spec-reporter":"0' npm ERR! A complete log of this run can be found in: npm ERR! e:softwareEXP ode.js ode_cache\_logs2018-09-12T06_13_21_597Z-debug.log
这时候有一个解决方案,就是执行下面的代码后再重新执行一次安装element-ui的命令:
npm cache clean --force
安装成功会出现下面的提示,可以看到安装的版本是+ element-ui@2.4.6:
Administrator@HTYYEML4JA3HA0P MINGW64 /f/03 prc/prc/noshery $ npm i element-ui -S npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modulesfsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) + element-ui@2.4.6 added 6 packages from 6 contributors in 30.767s
如果再安装不成功,可以试试加sudo提升权限进行-g全局安装。