create-Vue-app创建项目报错SyntaxError: Unexpected end of JSON input while parsing near ‘…ttachment“:false,

create-Vue-app创建项目报错SyntaxError: Unexpected end of JSON input while parsing near ‘…ttachment":false,"tar’

##SyntaxError: Unexpected end of JSON input while parsing near ‘…ttachment":false,"tar’
错误情况
执行 下面命令行时,报错

create-react-app my-react-app

npm错误日志


```javascript
× Install fail! SyntaxError: Unexpected end of JSON input (file: C:\Users\14408\Desktop\webpack\webpack_start2\node_modules\_json-loader@0.5.7@json-loader\package.json)SyntaxError: Unexpected end of JSON input (file: C:\Users\14408\Desktop\webpack\webpack_start2\node_modules\_json-loader@0.5.7@json-loader\package.json)
    at JSON.parse (<anonymous>)
    at Object.readJSON (C:\Users\14408\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\utils.js:33:17)
    at readJSON.next (<anonymous>)
    at onFulfilled (C:\Users\14408\AppData\Roaming\npm\node_modules\cnpm\node_modules\co\index.js:65:19)
npminstall version: 3.27.0
rconfig=C:\Users\14408\.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://r.npm.taobao.org webpack@3.6.0 --save-dev

## 解决办法:

设置npm代理地址,命令如下:



> npm config set registry http://registry.cnpmjs.org

改回npm,只是设置代理就好了

一直用的淘宝npm代理,cnpm

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

切换回来,就不报错。详细起因不明白。

补充:把npm版本降级,实测可以解决,可能5.0以上版本有微妙的问题

node v9.2.0 npm v5.5.1

上面是我本机当前的环境信息,可以把npm降级后试试,命令如下

npm i -g npm@版本号

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值