我使用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