我使用yeoman angular-fullstack生成器构建了我的应用程序,然后根据自己的目的进行了修改。我建立dist文件夹以使用yo angular-fullstack部署到heroku:deploy heroku。它为我创建一个新的heroku应用程序,当我进入dist文件夹和git push heroku master时,一切都很好。Heroku部署错误:找不到模块'./errors/cast'
我希望能够将我现有的heroku应用程序添加到此dist文件夹的部署过程中,因此我遵循此文章How to link a folder with an existing Heroku app。然后,我可以使用与heroku不同的远程名称部署到我自己的应用程序。
当我开始在heroku上运行时,我总是收到相同的错误。我无法弄清楚为什么完全相同的代码在为我创建的应用上运行良好,但不是我现有的应用。这几乎就像我需要清除node_modules并再次推送?
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
这里是dist文件夹
{
"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"
}
}
不区分大小写/敏感部分为我解决了同样的问题 – Fabio