react-native create-react-app创建项目报错SyntaxError: Unexpected end of JSON input while parsing near '...ttachment":false,"tar' npm代理
SyntaxError: Unexpected end of JSON input while parsing near '...ttachment":false,"tar'
错误情况
执行 下面命令行时,报错
create-react-app my-react-app
npm错误日志如下
161 silly pacote version manifest for webpack@3.8.1 fetched in 116ms
162 silly resolveWithNewModule webpack@3.8.1 checking installable status
163 http fetch GET 304 https://registry.npm.taobao.org/sw-precache-webpack-plugin 155ms (from cache)
164 silly pacote version manifest for sw-precache-webpack-plugin@0.11.4 fetched in 156ms
165 silly resolveWithNewModule sw-precache-webpack-plugin@0.11.4 checking installable status
166 http fetch GET 304 https://registry.npm.taobao.org/eslint-plugin-react 406ms (from cache)
167 silly pacote version manifest for eslint-plugin-react@7.4.0 fetched in 412ms
168 silly resolveWithNewModule eslint-plugin-react@7.4.0 checking installable status
169 http fetch GET 304 https://registry.npm.taobao.org/case-sensitive-paths-webpack-plugin 598ms (from cache)
170 silly pacote version manifest for case-sensitive-paths-webpack-plugin@2.1.1 fetched in 599ms
171 silly resolveWithNewModule case-sensitive-paths-webpack-plugin@2.1.1 checking installable status
172 silly pacote http://registry.npm.taobao.org/fsevents/download/fsevents-1.1.2.tgz extracted to /var/folders/09/wz7n0jm57595m97_zpcl7h6m0000gn/T/npm-2400-75ffb0fc/unpack-e2104430 by content address 367ms
173 silly addBundled read tarball
174 silly cleanup remove extracted module
175 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...ttachment":false,"tar'
175 verbose stack at JSON.parse (<anonymous>)
175 verbose stack at parseJson (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/json-parse-better-errors/index.js:7:17)
175 verbose stack at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/body.js:96:50)
175 verbose stack at <anonymous>
175 verbose stack at process._tickCallback (internal/process/next_tick.js:188:7)
176 verbose cwd /Users/shanshanxue/Documents/workspace/my-react-app
177 verbose Darwin 16.4.0
178 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts"
179 verbose node v9.2.0
180 verbose npm v5.5.1
181 error Unexpected end of JSON input while parsing near '...ttachment":false,"tar'
182 verbose exit [ 1, true ]
解决办法:
设置npm代理地址,命令如下:
npm config set registry http://registry.cnpmjs.org
之前一直用的淘宝npm代理
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@4
再补充
使用 yarn 安装
npm i -g yarn
react-native create-react-app创建项目报错SyntaxError: Unexpected end of JSON input while parsing near '...ttachment":false,"tar' npm代理的更多相关文章
- create-react-app创建项目报错SyntaxError: Unexpected end of JSON input while parsing near '...ttachment":false,"tar' npm代理
SyntaxError: Unexpected end of JSON input while parsing near '...ttachment":false,"tar' 错误 ...
- npm install 报错 error Unexpected end of JSON input while parsing near '...sShrinkwrap":false,"d' 解决办法
npm install 报错 : error Unexpected end of JSON input while parsing near '...sShrinkwrap":false,& ...
- npm install 安装项目依赖,报错ERR! Unexpected end of JSON input while parsing near的方法汇总
问题描述: npm install 安装项目依赖的时候,有时会出现: ERR! Unexpected end of JSON input while parsing near 错误 原因: npm 的 ...
- vue-cli3.x npm create projectName 报错: Unexpected end of JSON input while parsing near......
npm 版本与node版本还有webpack版本之间的问题 清理缓存,“ npm cache clean --force " 一切OK
- 使用Angular cli创建组件报错: Unexpected token / in JSON at position....
之前为了熟悉流程一直都是手动创建组件,今天试着用cli创建组件,居然报错了,报错大致为: Unexpected token / in JSON at position.... ,并且错误指向了.ang ...
- 【微信】微信小程序 微信开发工具中新创建的json文件,编译报错VM1781:2 pages/module/module.json 文件解析错误 SyntaxError: Unexpected end of JSON input
如果新创建报错:编译报错VM1781:2 pages/module/module.json 文件解析错误 SyntaxError: Unexpected end of JSON input 解决方法 ...
- ES6 - 报错整理(1): Unexpected end of JSON input while parsing near '...es":"7.0.0-alpha.11",'
npm install --save-dev 安装 babel-preset-env时一直报错 Unexpected end of JSON input while parsing near '... ...
- react创建项目报错unexpected end of json while parsing near xxx
报这个错,执行下面的命令,然后重新创建项目就可以. npm cache clean --force
- python3.7环境下创建app,运行Django1.11版本项目报错SyntaxError: Generator expression must be parenthesized
咳咳!!! 今天用命令行创建django项目中的app应用,出现了这样一个错误 这个错误在python3.6版本下安装运行django 1.11版本正常运行,但python3.7版本下运行django ...
随机推荐
- NSOperationQueue 和 NSOperation
The NSOperationQueue class regulates the execution of a set of NSOperation objects. After being adde ...
- [置顶]
zabbix通过lykchat发送告警信息配置过程
本文介绍zabbix通过lykchat发送告警信息配置过程. lykchat代码在https://github.com/lykops/lykchat/ 步骤 编写脚本 1).查看服务器端的配置文件et ...
- C源程序到可执行文件的四个过程
C源程序到可执行文件的四个过程 1.预处理:预编译器执行.譬如C中的宏定义就是由预编译器处理,注释等也是由预编译器处理的 gcc -E -hello.c -o hello.i 2.编译:编译器来执行. ...
- rabbitmq集群节点操作
节点恢复过程中把数据删掉很重要,恢复一单结点,再清数据 节点增加: 1. rabbitmq-server -detached --- .erlang.cooike的权限,400 属主rabbitm ...
- Mybatis通用分页
分页分为真分页和假分页,而 MyBatis 本身没有提供基于数据库方言的分页功能,而是基于 JDBC 的游标分页,很容易出现性能问题.网上提供的一个解决方案感觉还不错,是基于 MyBatis 本身的插 ...
- Material Design (二),TextInputLayout的使用
前言 一般登录注冊界面都须要EditText这个控件来让用户输入信息,同一时候我们通常会设置一个标签(使用TextView)和EditText的hint属性来提示用户输入的内容,而设计库中高级组件T ...
- 使用WIFI连接android进行调试和adb操作
本人需要wifi连接android进行调试的原因主要是要经常用到IDA pro进行调试,但手头有的IDA Pro版本只是windows的,开发可能更多用Mac OS X了,来回拔插.调试很不方便,所以 ...
- webstorm定位如何在代码后面?
写代码的时候定位总是在任意一点,而不是在代码的最后面. 以至于写代码的时候总会莫名其妙出现很多空格之类的奇怪报错. 取消图中选项
- HBase数据同步到ElasticSearch的方案
ElasticSearch的River机制 ElasticSearch自身提供了一个River机制,用于同步数据. 这里能够找到官方眼下推荐的River: http://www.elasticsear ...
- 【BIEE】页面跳转以及跳转后返回
报表开发过程中,我们经常会遇到这种问题:知道统计结果,然后根据统计结果去看明细数据 很多人可能首先想到的就是钻探,钻探是一种方法,但是不是唯一的办法,可以使用页面跳转完成. 下面举个例子 页面A 现在 ...