我有一个使用node.js在Heroku中运行的应用程序。直到一段时间以前,它一直在工作(像往常一样)。我没有收到任何通知。我没有更改服务器端和客户端的任何代码。我在Heroku中收到了以下错误。
错误登录Heroku
2017-07-18T04:16:42.967561+00:00 app[web.1]: TypeError: jsdom.env is not a function
2017-07-18T04:16:42.967563+00:00 app[web.1]: at /app/server.js:77:11
2017-07-18T04:16:42.967564+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2017-07-18T04:16:42.967565+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2017-07-18T04:16:42.967566+00:00 app[web.1]: at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
2017-07-18T04:16:42.967566+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2017-07-18T04:16:42.967567+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:281:22
2017-07-18T04:16:42.967568+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2017-07-18T04:16:42.967568+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2017-07-18T04:16:42.967569+00:00 app[web.1]: at /app/server.js:27:5
2017-07-18T04:16:42.967569+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
的package.json
{
"name": "project-name",
"description": "",
"version": "0.0.0",
"private": true,
"dependencies": {
"body-parser": "*",
"express": "*",
"jquery": "*",
"jsdom": "*",
"web-push": "*"
}
}
我的javascript文件顶部还有以下内容。
var $ = require('jquery'),
jsdom = require("jsdom"),
express = require('express'),
app = express(),
webPush = require('web-push'),
bodyParser = require('body-parser');
所以我不确定为什么我收到这个错误。