错误:在 Heroku 上找不到模块“./proto”

问题描述 投票:0回答:1

我似乎无法弄清楚为什么这在本地工作正常,但是当我将其推送到Heroku时,它失败并出现以下错误。

Heroku 的错误

Starting process with command `node web.js`

module.js:337
    throw new Error("Cannot find module '" + request + "'");
          ^
Error: Cannot find module './proto'
    at Function._resolveFilename (module.js:337:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:359:17)
    at require (module.js:375:17)
    at Object.<anonymous> (/app/node_modules/express/node_modules/connect/lib/connect.js:14:13)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
    at Function._load (module.js:311:12)
    at Module.require (module.js:359:17)
Process exited with status 1
State changed from starting to crashed

package.json

{
  "name": "divtest",
  "version": "0.0.2",
  "dependencies": {
    "underscore": "1.3.x",
    "crypto": "0.0.x",
    "knox": "0.3.x",
    "mongoose": "~3.1.2",
    "mime": "1.2.x",
    "express": "3.0.x",
    "request": "~2.9.203"
  },
  "engines": {
    "node": "0.6.x",
    "npm": "1.0.x"
  }
}

./proto
connect
正在调用的本地模块

我已经吹走了我的

./node_modules
文件夹并做了
npm install --save
,但仍然得到相同的结果。

node.js express heroku node.js-connect
1个回答
2
投票

我遇到了这个问题,我的问题是我是 git 初学者,没有正确提交所需的所有文件。看起来好像有一个 proto.js 连接在某处。

我做了一个 git add * (...) 并再次推送,一切都很顺利。

另一个明显的错误是,在推送时 Heroku 抱怨未满足的依赖关系。

© www.soinside.com 2019 - 2024. All rights reserved.