【发布时间】:2017-06-03 18:17:11
【问题描述】:
我有包含所有依赖项的 package.json 并使用 webpack 启动脚本。在部署到 heroku 时,我收到错误 R10(启动超时)-> Web 进程在启动后 60 秒内无法绑定到 $PORT
"scripts": {
"start": "webpack-dev-server --test"
},
Webpack 配置文件。
var config = {
entry: './main.js',
output: {
path:'./',
filename: 'index.js',
},
devServer: {
inline: true,
port: process.env.PORT || 8010
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
},
{ test: /\.css$/, loader: "style!css" },
]
}
}
module.exports = 配置;
【问题讨论】:
-
如果你在 heroku 上托管它,为什么你想要这个端口??
-
@MayankShukla 仅用于在本地主机上运行。我也尝试删除该端口,但仍然无法正常工作
-
@RahulTailwal:你能解决这个问题吗?请分享
标签: node.js reactjs heroku npm webpack