Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 摩根赢了';t加载模块';调试';论赫罗库_Node.js_Heroku_Express - Fatal编程技术网

Node.js 摩根赢了';t加载模块';调试';论赫罗库

Node.js 摩根赢了';t加载模块';调试';论赫罗库,node.js,heroku,express,Node.js,Heroku,Express,我的express设置中有这个 var morgan = require("morgan"); app.use(morgan("dev")); 这适用于我的开发macine,但在部署到Heroku时崩溃: heroku[web.1]: Starting process with command `node server.js` app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMO

我的express设置中有这个

var morgan     = require("morgan");
app.use(morgan("dev"));
这适用于我的开发macine,但在部署到Heroku时崩溃:

heroku[web.1]: Starting process with command `node server.js`
app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
app[web.1]: Recommending WEB_CONCURRENCY=1
app[web.1]:     at Module._compile (module.js:460:26)
app[web.1]:     at Object.<anonymous> (/app/node_modules/morgan/index.js:16:13)
app[web.1]:     at Function.Module._load (module.js:310:12)
app[web.1]: module.js:338
app[web.1]:     at Module.require (module.js:365:17)
app[web.1]:     throw err;
app[web.1]:     at Module.load (module.js:355:32)
app[web.1]:     at Object.Module._extensions..js (module.js:478:10)
app[web.1]:           ^
app[web.1]:     at Module.require (module.js:365:17)
app[web.1]: Error: Cannot find module 'debug'
app[web.1]:     at Function.Module._resolveFilename (module.js:336:15)
app[web.1]:     at Function.Module._load (module.js:278:25)
app[web.1]:     at require (module.js:384:17)
heroku[web.1]: State changed from starting to crashed
index.js的第16行读取
var debug=require('debug')('morgan')

调试模块确实缺少一个
索引.js
,但它的
包.json
中有这个索引

  "main": "./node.js",
  "browser": "./browser.js",
  "component": {
    "scripts": {
      "debug/index.js": "browser.js",
      "debug/debug.js": "debug.js"
    }
  },

事实证明,这与一个过时的软件包有关,更新到最新版本使我能够进步

您能更明确地使用此解决方案吗?我有一个类似的问题,不知道你是否有任何进一步的信息。我已经忘记了,但看起来好像我安装了一个旧版本的Morgan并对其进行了更新修复
  "main": "./node.js",
  "browser": "./browser.js",
  "component": {
    "scripts": {
      "debug/index.js": "browser.js",
      "debug/debug.js": "debug.js"
    }
  },