我卸载了webpack并删除了webpack.config.js
文件,以便我可以将express.js
与Heroku一起使用。提交并推送到heroku后,我的日志如下:
$ heroku logs
2017-09-10T17:42:43.224045+00:00 heroku[web.1]: State changed from crashed to starting
2017-09-10T17:42:02.000000+00:00 app[api]: Build succeeded
2017-09-10T17:42:47.480825+00:00 heroku[web.1]: Starting process with command `node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js`
2017-09-10T17:42:50.050087+00:00 app[web.1]: module.js:471
2017-09-10T17:42:50.050108+00:00 app[web.1]: throw err;
2017-09-10T17:42:50.050108+00:00 app[web.1]: ^
2017-09-10T17:42:50.050109+00:00 app[web.1]:
2017-09-10T17:42:50.050110+00:00 app[web.1]: Error: Cannot find module '/app/node_modules/webpack-dev-server/bin/webpack-dev-server.js'
日志中的启动过程是尝试启动webpack ^,但在我的Procfile中我有这个:
web: node server.js
要确认,这里是heroku ps
$ heroku ps
=== web (Free): node server.js (1)
web.1: up 2017/09/10 14:41:56 -0400 (~ 27m ago)
的package.json:
{
"name": "youtube-instant-search",
"version": "1.0.0",
"description": "Renders youtube videos after keystrokes",
"main": "index.js",
"repository": "git@github.com:mattwarren10/youtube-instant-
search.git",
"scripts": {
"start": "node server.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel": "^5.8.29",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^7.2.3",
"babel-loader": "^6.4.1",
"babel-preset-env": "^1.6.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2016": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"babelify": "^7.3.0",
"bootstrap": "^4.0.0-alpha.6",
"browserify": "^14.4.0",
"css-loader": "^0.28.7",
"eslint": "^4.6.1",
"node-sass": "^4.5.3",
"rimraf": "^2.6.1",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2"
},
"dependencies": {
"@types/react-addons-create-fragment": "^0.14.17",
"babel-preset-stage-1": "^6.1.18",
"core-js": "^2.5.1",
"express": "^4.15.4",
"lodash": "^3.10.1",
"prop-types": "^15.5.10",
"react": "^0.14.3",
"react-dom": "^0.14.3",
"react-intl": "^2.3.0",
"react-redux": "^4.0.0",
"redux": "^3.0.4",
"youtube-api-search": "0.0.5"
}
}
server.js:
var express = require('express');
var app = express();
var path = require('path');
app.use(express.static(path.join(__dirname)));
app.use("/style", express.static(__dirname));
// viewed at based directory http://localhost:8080/
app.get('/', function (req, res) {
res.sendFile(path.join(__dirname + 'index.html'));
});
app.listen(process.env.PORT || 8080);
heroku更新需要时间吗?发生了什么事?