1. 程式人生 > >create-react-app 搭建專案報錯Unexpected end of JSON input while parsing near...

create-react-app 搭建專案報錯Unexpected end of JSON input while parsing near...

錯誤:

[email protected] ~/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 [email protected]6.1.0 3 info using [email protected].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 [email protected] 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 [email protected] fetched in 613ms 11 http fetch GET 200 https://registry.npm.taobao.org/react-dom 786ms 12 silly pacote tag manifest for [email protected] 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

相關推薦

create-react-app 搭建專案Unexpected end of JSON input while parsing near...

錯誤: [email protected] ~/WebstormProjects $ create-react-app test-react-app Creating a new React app in /home/jane/Webstorm

npm install :error Unexpected end of JSON input while parsing near '...https://registry.npmj'的解決辦法

記: 在npm install前端專案時報錯:error Unexpected end of JSON input while parsing near '...https://registry.npmj' 解決辦法: 1.先清理一下快取: npm cache clean --for

Unexpected end of JSON input while parsing near '...gistry.npmjs.org/glob'

1、重新建立空專案:ng new 專案名稱 --skip-install 2、進入你的專案目錄:cd 專案名稱 3、重新設定連結:npm set registry https://registry.npmjs.org/ 4、重置cache:npm cache clean -

npm install出現: Unexpected end of JSON input while parsing near

安裝node版本管理工具的時候 把node解除安裝了 然後重新安裝了node版本 然後就出現了Unexpected end of JSON input while parsing near 網上各種查,,,,終於解決了 第一種情況是 最新版的Nodejs與np

解決Unexpected end of JSON input while parsing near '...},"_hasShrinkwrap":fa'

解決Unexpected end of JSON input while parsing near ‘…},"_hasShrinkwrap":fa’ 今天匯入一個新react專案,使用npm install安裝依賴的時候遇到了 npm WARN deprecat

npm ERR! Unexpected end of JSON input while parsing near '...",'

npm install 的時候出現錯誤: npm ERR! Unexpected end of JSON input while parsing near '...","webpack-dev-serv

解決npm ERR! Unexpected end of JSON input while parsing near '...e":"ngrx-store-freeze'

問題描述:試圖執行從git遠端倉庫pull下的程式碼時提示需要npm install。 但是執行npm install之後會報如下錯誤。 於是網上搜索求助,發現需要 之後再重新執行npm install,安裝成功之後即可重新執行ng serve

npm ERR! Unexpected end of JSON input while parsing near" "

今天在做專案的時候不小心刪了node包結果就一直報錯,,,,初始化也麼用。。。 npm ERR! Unexpected end of JSON input while parsing near '..

vue-cli create project時出現“Unexpected end of JSON input while parsing”解決方法

今天準備用vue-cli create project時提醒node要8.9up,於是就更新一波,順帶騷操作連npm也更到了6 一切準備完畢後就create project,進度到七八十就就報了個錯“ Unexpected end of JSON input while parsi

【微信】微信小程序 微信開發工具中新創建的json文件,編譯VM1781:2 pages/module/module.json 文件解析錯誤 SyntaxError: Unexpected end of JSON input

page class 報錯 技術分享 微信開發 圖片 alt http ges 如果新創建報錯:編譯報錯VM1781:2 pages/module/module.json 文件解析錯誤 SyntaxError: Unexpected end of JSON input

npm i 安裝依賴包提示字符串解析異常(Unexpected end of JSON input

npm nodejs json解析異常 請確保網絡較好,個人因為網絡原因折騰了好久,資源庫可以設置為https://registry.npm.taobao.org/ 設置和查看命令如下:npm config set registry="https://registry.npm.taoba

Ajax | Unexpected end of JSON input

  function Ajax(method, url, callback) { let xhr = new XMLHttpRequest() xhr.open(method, url, true) xhr.onreadystatechange = () => {

Unexpected end of JSON input

業務邏輯如下: 1、前端ajax呼叫後臺controller方法,controller中呼叫外部http介面,封裝了一個HttpURLConnection物件的呼叫方法。目前對端介面還未完成,所以本地編寫介面接收http請求處理並返回。前端頁面始終報: SyntaxError: Unex

create-react-app搭建react專案

1.全域性安裝create-react-app npm install -g create-react-app 2.建立專案 create-react-app 專案資料夾名 3.進入專案 3.1 cd 專案資料夾名 建立之後的專案目錄

第一個React專案——使用官方腳手架create-react-app搭建第一個React專案

準備工作 1,node js環境 一、下載create-react-app           1)使用命令列的方式進入目標資料夾(shift+右鍵,此處開啟powershell視窗)(win10)           2)輸入命令  npx create-react

laravel新搭建專案記錄

目錄 環境 環境 最近重新編譯安裝了虛擬機器,重新部署了 laravel 專案,記錄一下常見問題。 1. vendor 目錄找不到 錯誤提示是開啟  vendor 自動載入檔案失敗。當然,新專案是沒有vendor 這個資料夾的。需要安裝

基於create-react-app官方腳手架搭建dva模式的專案(一)

思索良久,決定還是記錄下心得體會:一個基於create-react-app官方腳手架,搭建起來的dva開發模式的react專案。 當然現今的前端市場如此強大,你可以在網路上找到你想要的任何腳手架,並且很多可以開箱即用,不可否認它們很優秀,開發它們的人或團隊更值得我們豎起大拇

使用express, create-react-app, mongodb搭建react模擬數據開發環境

相對 依賴 demon es6 技術分享 利用 卡頓 demo all 提要 最近剛剛完成了一個vue的項目,其中涉及的用戶數有6000多個以及其他數據也比較多,為了在前端能夠真實的進行數據模擬,所有把全量數據拷貝下來放到了api.json中。這樣導致整個api.json文

專案不能修改web-app下的version

報錯描述 Cannot change version of project facet Dynamic Web Module to 2.5. 解決方案 1.修改專案web.xml中web-app標籤下的version 2.修改專案路徑下的setting目錄下的org.eclip

Create React App 專案中使用 Prettier

前言 如果你只想知道如何在 WebStorm 或 VS Code 中,使用 Prettier 去自動格式化程式碼,那就一拉到底,直奔主題吧。 Prettier 介紹 Prettier 是一個「武斷的」(官網用詞:opinionated)程式碼格式化工具。 它只提供了