create-react-app 搭建项目报错Unexpected end of JSON input while parsing near...

错误:

jane@ljj ~/WebstormProjects $ create-react-app test-react-app

Creating a new React app in /home/jane/WebstormProjects/test-react-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

npm ERR! Unexpected end of JSON input while parsing near '...0"},"_hasShrinkwrap":'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jane/.npm/_logs/2018-06-09T06_14_46_082Z-debug.log

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.

Deleting generated file... package.json
Deleting test-react-app / from /home/jane/WebstormProjects
Done.

/home/jane/.npm/_logs/2018-06-09T06_14_46_082Z-debug.log文件的错误信息

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   '--save',
1 verbose cli   '--save-exact',
1 verbose cli   '--loglevel',
1 verbose cli   'error',
1 verbose cli   'react',
1 verbose cli   'react-dom',
1 verbose cli   'react-scripts' ]
2 info using npm@6.1.0
3 info using node@v10.4.0
4 verbose npm-session 316e959b45b2d620
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npm.taobao.org/react 439ms (from cache)
8 silly fetchPackageMetaData error for react@latest Unexpected end of JSON input while parsing near '...0"},"_hasShrinkwrap":'
9 http fetch GET 304 https://registry.npm.taobao.org/react-scripts 591ms (from cache)
10 silly pacote tag manifest for react-scripts@latest fetched in 613ms
11 http fetch GET 200 https://registry.npm.taobao.org/react-dom 786ms
12 silly pacote tag manifest for react-dom@latest fetched in 814ms
13 timing stage:rollbackFailedOptional Completed in 1ms
14 timing stage:runTopLevelLifecycles Completed in 2171ms
15 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...0"},"_hasShrinkwrap":'
15 verbose stack     at JSON.parse (<anonymous>)
15 verbose stack     at parseJson (/usr/local/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
15 verbose stack     at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
15 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
16 verbose cwd /home/jane/WebstormProjects/test-react-app
17 verbose Linux 4.4.0-53-generic
18 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts"
19 verbose node v10.4.0
20 verbose npm  v6.1.0
21 error Unexpected end of JSON input while parsing near '...0"},"_hasShrinkwrap":'
22 verbose exit [ 1, true ]

npm代理为淘宝的代理的时候就会发生这样的错误,将npm代理换回来就不报错了,具体原因不详,但是亲证可行

npm config set registry http://registry.cnpmjs.org
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值