2017-04-11 3 views
1

fixiert ich versuche App Heroku bereitstellen reagieren, bekam aber diese Fehlermeldung durch Heroku Protokolle,Heroku PORT Zuordnungsfehler, obwohl ich es

2017-04-11T04:54:31.000000+00:00 app[api]: Build started by user [email protected] 
2017-04-11T04:55:05.124340+00:00 app[api]: Deploy 8f241f1 by user [email protected] 
2017-04-11T04:55:05.124340+00:00 app[api]: Release v8 created by user [email protected] 
2017-04-11T04:54:31.000000+00:00 app[api]: Build succeeded 
2017-04-11T04:55:05.490326+00:00 app[api]: Release v8 created by user [email protected] 
2017-04-11T04:55:05.742229+00:00 heroku[web.1]: State changed from crashed to starting 
2017-04-11T04:55:09.582152+00:00 heroku[web.1]: Starting process with command `npm start` 
2017-04-11T04:55:11.697099+00:00 app[web.1]: 
2017-04-11T04:55:11.697113+00:00 app[web.1]: > [email protected] start /app 
2017-04-11T04:55:11.697114+00:00 app[web.1]: > webpack-dev-server --progress --profile --colors 
2017-04-11T04:55:11.697115+00:00 app[web.1]: 
2017-04-11T04:55:12.594 70% 1/1 build modules http://127.0.0.1:54499/ 
2017-04-11T04:55:12.594337+00:00 app[web.1]: webpack result is served from/
2017-04-11T04:55:12.594384+00:00 app[web.1]: content is served from ./public 
2017-04-11T04:55:12.594457+00:00 app[web.1]: 404s will fallback to /index.html 
2017-04-11T04:55:17. 42% 73/136 build modules 
2017-04-11T04:55:17 58% 180/223 build modules 
2017-04-11T04:55:17.879336+00:00 app[web.1] 63% 281/315 build modules 
2017-04-11T04:55:17.879336+00:0 63% 373/415 build modules 
2017-04-11T04:55:17.879 68% 484/496 build modules 
2017-04-11T04:55:17.879336+00:00 app[we5304ms build modules  
2017-04-11T04:55:17.886137+00:00 app8ms seal 
2017-04-11T04:55:17.896354+00:0010ms optimize 
2017-04-11T04:55:17.908569+00:00 12ms hashing 
2017-04-11T04:55:18.762ms create chunk assets 
2017-04-11T04:55:18ms additional chunk assets 
2017-04-11T04:55:180ms optimize chunk assets 
2017-04-11T04:55:18.8373149ms optimize assets 
2017-04-11T04:55:18.896612+00:00 app59ms emit 
2017-04-11T04:56:10.046877+00:00 app[web.1]: Error waiting for process to 
terminate: No child processes 
2017-04-11T04:56:10.028392+00:00 heroku[web.1]: Error R10 (Boot timeout) -> 
Web process failed to bind to $PORT within 60 seconds of launch 
2017-04-11T04:56:10.028452+00:00 heroku[web.1]: Stopping process with SIGKILL 
2017-04-11T04:56:10.147218+00:00 heroku[web.1]: Process exited with status 22 
2017-04-11T04:56:10.134762+00:00 heroku[web.1]: State changed from starting to 
crashed 

So schaute ich auf, dass R10 Fehlermeldung und viele Leute sagten, Das liegt daran, dass ich meine PORT-Nummer nicht so konfiguriert habe, dass sie von Heroku zugewiesen wird. Aber meine webpack.config.js Datei zeigt deutlich process.env.PORT wie folgt aus:

"use strict"; 
    var webpack = require('webpack'); 
    var path = require('path'); 
    var loaders = require('./webpack.loaders'); 
    var HtmlWebpackPlugin = require('html-webpack-plugin'); 
    var DashboardPlugin = require('webpack-dashboard/plugin'); 
    var ExtractTextPlugin = require('extract-text-webpack-plugin'); 

    const HOST = process.env.HOST || "127.0.0.1"; 
    const PORT = process.env.PORT || "8888"; 

    loaders.push({ 
     test: /\.scss$/, 
     loader: ExtractTextPlugin.extract('style', 'css?sourceMap&localIdentName=[local]___[hash:base64:5]!sass?outputStyle=expanded'), 
     exclude: ['node_modules'] 
    }); 

    module.exports = { 
     entry: [ 
      'react-hot-loader/patch', 
      './src/index.jsx', // your app's entry point 
      './styles/index.scss' 
     ], 
     debug: true, 
     devtool: '#eval-source-map', 
     output: { 
      publicPath: '/', 
      path: path.join(__dirname, 'public'), 
      filename: 'bundle.js' 
     }, 
     resolve: { 
      extensions: ['', '.js', '.jsx'] 
     }, 
     module: { 
      loaders 
     }, 
     devServer: { 
      contentBase: "./public", 
      // do not print bundle build stats 
      noInfo: true, 
      // enable HMR 
      hot: true, 
      // embed the webpack-dev-server runtime into the bundle 
      inline: true, 
      // serve index.html in place of 404 responses to allow HTML5 history 
      historyApiFallback: true, 
      port: PORT, 
      host: HOST 
     }, 
     plugins: [ 
      new webpack.NoErrorsPlugin(), 
      new webpack.HotModuleReplacementPlugin(), 
      new ExtractTextPlugin("style.css", { 
        allChunks: true 
      }), 
      new DashboardPlugin(), 
      new HtmlWebpackPlugin({ 
       template: './src/template.html', 
       files: { 
        css: ['style.css'], 
        js: [ "bundle.js"], 
       } 
      }), 
     ] 
    }; 

FYI, mein ganzes GitHub Repo ist here. Bitte helfen Sie mir damit alle!

Antwort

0

Ich bin nicht sicher, aber ich denke nicht, dass Sie den Port in der Webpack-Konfigurationsdatei angeben sollten. Dasselbe gilt für devServer.host. Laut den Dokumenten ist devServer.port nur CLI. Sie geben es als Flag an, wenn Sie Webpack in der Konsole ausführen. Sie sollten Ihren Port in Ihrer Eintragsdatei angeben, die die PORT-Variable verwendet. https://webpack.js.org/configuration/dev-server/#devserver-host-cli-only https://webpack.js.org/configuration/dev-server/#devserver-port-cli-only

0

Gelöst:

I vorformulierten Reaktion wurde mit und erkannte, dass die localhost Ich habe tatsächlich von webpack-dev-Server gehostet wird, im Einsatz. Also fügte ich eine einfache Node-Server-Datei hinzu und servierte die Datei, die sich im öffentlichen Verzeichnis befindet, das durch das Bündeln erstellt wird.

Verwandte Themen