Heroku的部署错误:无法找到模块“./errors/ca​​st”模块、错误、Heroku、st

2023-09-13 04:06:27 作者:╭ァ再回首ヾ恍然如夢

我使用的自耕农角fullstack发生器,然后修改为我自己的目的而建造我的应用程序。我建dist文件夹来部署Heroku的使用哟角fullstack:部署的Heroku。它创造了我一个新的Heroku应用程序,当我cd到dist文件夹和混帐推Heroku上样样精通的伟大工程。

我希望能够把我的现有Heroku的应用程序添加到部署过程本DIST文件夹,所以我跟着这个帖子How到一个文件夹与现有的Heroku应用链接。我能够再部署到自己的应用程序比Heroku的一个不同的远程名。

我不断收到同样的错误,当它开始在Heroku上运行。我想不通,为什么完全一样的code运行正常对我而不是我现有的应用程序创建的应用程序。这几乎就像我需要清除node_modules并再次推?

  2014-02-21T04:43:51.989439 + 00:00的应用[web.1]:module.js:340    2014-02-21T04:43:51.996351 + 00:00的应用[web.1]:错误:找不到模块'./errors/ca​​st    2014-02-21T04:43:51.996351 + 00:00的应用[web.1]:在Function.Module._resolveFilename(module.js:338:15)    2014-02-21T04:43:51.991555 + 00:00的应用[web.1]:扔走错了路。    2014-02-21T04:43:51.991785 + 00:00的应用[web.1]:^    2014-02-21T04:43:51.996351 + 00:00的应用[web.1]:在要求(module.js:380:17)    2014-02-21T04:43:51.996351 + 00:00的应用[web.1]:在Module.require(module.js:36四点17)    2014-02-21T04:43:51.996351 + 00:00的应用[web.1]:在Function.Module._load(module.js:280:25)    2014-02-21T04:43:51.996351 + 00:00的应用[web.1]:在Module._compile(module.js:456:26)    2014-02-21T04:43:51.996351 + 00:00的应用[web.1]:在Function.Module._load(module.js:312:12)    2014-02-21T04:43:51.996351 + 00:00的应用[web.1]:在对象<&匿名GT; (/app/node_modules/mongoose/lib/error.js:32:27)    2014-02-21T04:43:51.996351 + 00:00的应用[web.1]:在Module.load(module.js:356:32)    2014-02-21T04:43:51.996351 + 00:00的应用[web.1]:在Object.Module._extensions..js(module.js:474:10)    2014-02-21T04:43:51.996560 + 00:00的应用[web.1]:在Module.require(module.js:364:17)    2014-02-21T04:43:53.457214 + 00:00的Heroku [web.1]:国家从开始改变坠毁 

下面是我从packages.json dist文件夹

  {       名:的myapp       版本:1.0.0       依赖:{         恩preSS:〜3.4.3         lodash:〜2.4.1         猫鼬:〜3.5.5         猫鼬唯一的验证器:〜0.3.0         连接 - 蒙戈:〜0.4.0         护照:最新         护照地方:最新         护照脸谱:最新         护照微博:最新         护照谷歌:最新         EJS:〜0.8.4       },       引擎: {         节点:> = 0.10.0        },        脚本:{          测试:咕噜测试        }      } 

解决方案

的问题是几乎可以肯定,你有没有在你需要的所有文件进行检查。如果你不能看到你的git仓库问题,请尝试运行的Heroku运行的bash ,并使用 CD LS 更多来看看周围发生了什么得到部署到Heroku和看缺什么。

您的问题可能是你有要求('./错误/投')但在投文件还没有检查。

更新:

另一个可能性是您在 ./错误/施放检查在OS X是不区分大小写,但文件不能在Linux上找到这情况下,敏感。

I built my app using yeoman angular-fullstack generator and then modified for my own purposes. I built the dist folder to deploy to heroku using yo angular-fullstack:deploy heroku. It creates a new heroku app for me and when I cd into the dist folder and git push heroku master everything works great.

I want to be able to add my existing heroku app to the deployment process for this dist folder so I followed this post How to link a folder with an existing Heroku app. I'm able to then deploy to my own app with a different remote name than heroku.

I keep getting the same error when it starts to run on heroku. I can't figure out why the exact same code runs fine on the app created for me but not my existing app. It's almost like I need to clear the node_modules and push again?

    2014-02-21T04:43:51.989439+00:00 app[web.1]: module.js:340
    2014-02-21T04:43:51.996351+00:00 app[web.1]: Error: Cannot find module './errors/cast'
    2014-02-21T04:43:51.996351+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:338:15)
    2014-02-21T04:43:51.991555+00:00 app[web.1]:     throw err;
    2014-02-21T04:43:51.991785+00:00 app[web.1]:           ^
    2014-02-21T04:43:51.996351+00:00 app[web.1]:     at require (module.js:380:17)
    2014-02-21T04:43:51.996351+00:00 app[web.1]:     at Module.require (module.js:36         4:17)
    2014-02-21T04:43:51.996351+00:00 app[web.1]:     at Function.Module._load (module.js:280:25)
    2014-02-21T04:43:51.996351+00:00 app[web.1]:     at Module._compile (module.js:456:26)
    2014-02-21T04:43:51.996351+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
    2014-02-21T04:43:51.996351+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/mongoose/lib/error.js:32:27)
    2014-02-21T04:43:51.996351+00:00 app[web.1]:     at Module.load (module.js:356:32)
    2014-02-21T04:43:51.996351+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:474:10)
    2014-02-21T04:43:51.996560+00:00 app[web.1]:     at Module.require (module.js:364:17)
    2014-02-21T04:43:53.457214+00:00 heroku[web.1]: State changed from starting to crashed

Here is my packages.json from the dist folder

   {
       "name": "myapp",
       "version": "1.0.0",
       "dependencies": {
         "express": "~3.4.3",
         "lodash": "~2.4.1",
         "mongoose": "~3.5.5",
         "mongoose-unique-validator": "~0.3.0",
         "connect-mongo": "~0.4.0",
         "passport": "latest",
         "passport-local": "latest",
         "passport-facebook": "latest",
         "passport-twitter": "latest",
         "passport-google": "latest",
         "ejs": "~0.8.4"
       },
       "engines": {
         "node": ">=0.10.0"
        },
        "scripts": {
          "test": "grunt test"
        }
      }

解决方案

The issue is almost certainly that you haven't checked in all the files you need. If you can't see the problem in your git repository, try running heroku run bash and using cd, ls, and more to look around what's getting deployed to Heroku and see what is missing.

Your problem is likely that you have require('./errors/cast') but have not checked in a cast file.

Update:

The other likelihood is that you checked in ./errors/Cast on OS X which is case insensitive, but the file can't be found on Linux which is case sensitive.

 
精彩推荐