2017-09-07 99 views
0

我想主辦的Heroku的反應程序...問題作出反應應用在Heroku

我已經用CREATE-反應-app..And按照下面的方法在託管創建的應用程序...

 git init 
     heroku create $APP_NAME --buildpack https://github.com/mars/create-react-app-buildpack.git 
     git add . 
     git commit -m "Start with create-react-app" 
     git push heroku master 
     heroku open 

但是,當我試圖把應用的Heroku它返回以下錯誤...

 remote: - htmlparser.js:235 new HTMLParser 
     remote:  [build_4acd980d8a80e0486da141a82d0b3cee]/[html-minifier]/src/htmlparser.js:2 35:13 
     remote: 
     remote: - htmlminifier.js:946 minify 
     remote:  [build_4acd980d8a80e0486da141a82d0b3cee]/[html-minifier]/src/htmlminifier.js :946:3 
     remote: 
     remote: - htmlminifier.js:1299 exports.minify 
     remote:  [build_4acd980d8a80e0486da141a82d0b3cee]/[html-minifier]/src/htmlminifier.js :1299:10 
     remote: 
     remote: - index.js:296 
     remote:  [build_4acd980d8a80e0486da141a82d0b3cee]/[html-webpack-plugin]/index.js:296: 16 
     remote: 
     remote: - util.js:16 tryCatcher 
     remote:  [build_4acd980d8a80e0486da141a82d0b3cee]/[bluebird]/js/release/util.js:16:23 
     remote: - promise.js:512 Promise._settlePromiseFromHandler 
     remote:  [build_4acd980d8a80e0486da141a82d0b3cee]/[bluebird]/js/release/promise.js:51 2:31 
     remote: 
     remote: - promise.js:569 Promise._settlePromise 
     remote:  [build_4acd980d8a80e0486da141a82d0b3cee]/[bluebird]/js/release/promise.js:56 9:18 
     remote: 
     remote: - promise.js:614 Promise._settlePromise0 
     remote:  [build_4acd980d8a80e0486da141a82d0b3cee]/[bluebird]/js/release/promise.js:61 4:10 
     remote: 
     remote: - promise.js:693 Promise._settlePromises 
     remote:  [build_4acd980d8a80e0486da141a82d0b3cee]/[bluebird]/js/release/promise.js:69 3:18 
     remote: 
     remote: - async.js:133 Async._drainQueue 
     remote:  [build_4acd980d8a80e0486da141a82d0b3cee]/[bluebird]/js/release/async.js:133: 16 
     remote: 
     remote: - async.js:143 Async._drainQueues 
     remote:  [build_4acd980d8a80e0486da141a82d0b3cee]/[bluebird]/js/release/async.js:143: 10 
     remote: 
     remote: - async.js:17 Immediate.Async.drainQueues 
     remote:  [build_4acd980d8a80e0486da141a82d0b3cee]/[bluebird]/js/release/async.js:17:1 4 

我怎樣才能解決這個問題?

+0

你的目錄中是否有procfile文件?它應該在那裏告訴Heroku如何啓動你的應用程序。在proc文件中,你會放入類似於:web:npm start。在Heroku CLI中,嘗試運行heroku logs - tail來獲取更多的錯誤信息。 –

+0

@CrissiMariamRobert:我認爲問題出在你建立的時候。你可以嘗試用'yarn build'或'npm run build'來構建,看看是否會拋出錯誤? –

回答

0

我剛剛克隆你的回購,並試圖npm install + npm run build。我發現npm run build在本地失敗。所以,這是代碼錯誤,而不是Heroku部署。

失敗是從HTMLParser,所以我看着public/index.html,發現一個高度定製的模板。

要檢查public/index.html內容是否是問題所在,我將其替換爲默認的create-react-app HTML模板代碼。然後,npm run build成功完成。

因此,看起來您的public/index.html中的HTML的有效性存在問題,這會中斷create-react-app的模板引擎。我建議通過HTML validator運行它來查找問題,或者手動將模板分解爲更小的可測試片段,直到找到導致構建錯誤的部分。