鍍金池/ 問(wèn)答/HTML5  Linux  HTML/ npm err ( create-react-app 出錯(cuò)了)!! 大爺快來(lái)啊

npm err ( create-react-app 出錯(cuò)了)!! 大爺快來(lái)啊

全局安裝create-react-app后,創(chuàng)建項(xiàng)目出的錯(cuò),之前想怎么玩怎么玩,現(xiàn)在懵逼了,node重裝了也沒(méi)用,create-react-app卸了重新全局安裝也沒(méi)用,日志也看不出所以然

報(bào)錯(cuò)

clipboard.png

日志部分相關(guān)信息

720 silly pacote range manifest for babel-plugin-transform-es2015-parameters@^6.23.0 fetched in 219ms
721 silly resolveWithNewModule babel-plugin-transform-es2015-parameters@6.24.1 checking installable status
722 http fetch GET 304 https://registry.npm.taobao.org/babel-plugin-transform-es2015-unicode-regex 125ms (from cache)
723 silly pacote range manifest for babel-plugin-transform-es2015-unicode-regex@^6.22.0 fetched in 125ms
724 silly resolveWithNewModule babel-plugin-transform-es2015-unicode-regex@6.24.1 checking installable status
725 http fetch GET 304 https://registry.npm.taobao.org/babel-plugin-transform-es2015-modules-umd 234ms (from cache)
726 silly pacote range manifest for babel-plugin-transform-es2015-modules-umd@^6.23.0 fetched in 234ms
727 silly resolveWithNewModule babel-plugin-transform-es2015-modules-umd@6.24.1 checking installable status
728 http fetch GET 304 https://registry.npm.taobao.org/babel-plugin-transform-es2015-template-literals 219ms (from cache)
729 silly pacote range manifest for babel-plugin-transform-es2015-template-literals@^6.22.0 fetched in 219ms
730 silly resolveWithNewModule babel-plugin-transform-es2015-template-literals@6.22.0 checking installable status
731 http fetch GET 304 https://registry.npm.taobao.org/babel-plugin-transform-exponentiation-operator 140ms (from cache)
732 silly pacote range manifest for babel-plugin-transform-exponentiation-operator@^6.22.0 fetched in 140ms
733 silly resolveWithNewModule babel-plugin-transform-exponentiation-operator@6.24.1 checking installable status
734 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...76da68880d4cebeffd","'
734 verbose stack     at JSON.parse (<anonymous>)
734 verbose stack     at parseJson (D:\Apps\nodejs\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)
734 verbose stack     at consumeBody.call.then.buffer (D:\Apps\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\body.js:96:50)
734 verbose stack     at <anonymous>
734 verbose stack     at process._tickCallback (internal/process/next_tick.js:188:7)
735 verbose cwd D:\xx1
736 verbose Windows_NT 10.0.14393
737 verbose argv "D:\\Apps\\nodejs\\node.exe" "D:\\Apps\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts"
738 verbose node v8.9.1
739 verbose npm  v5.5.1
740 error Unexpected end of JSON input while parsing near '...76da68880d4cebeffd","'
741 verbose exit [ 1, true ]
回答
編輯回答
愚念

設(shè)置npm代理,執(zhí)行命令

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

然后重新 create 項(xiàng)目

create-react-app my-app
    ...
    Happy hacking!
//完成了...

之前用的淘寶代理

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

裝任何東西都o(jì)k,create-react-app也沒(méi)問(wèn)題,今天就突然掛掉了,只掛這一個(gè)啊,換回來(lái)居然就好了,無(wú)語(yǔ)!

2017年2月22日 13:30