“错误:找不到模块'pkginfo'” – 节点js应用程序部署到heroku

尝试第一次将我的node.js应用程序部署到Heroku时出现以下错误:

应用程序使用“生产”环境configuration2014-08-28T01:02:56.823904 + 00:00 app [web.1]:在Function.Module._resolveFilename(module.js:338:15)2014-08-28T01: 02:56.823906 + 00:00 app [web.1]:at Function.Module._load(module.js:280:25)2014-08-28T01:02:56.823900 + 00:00 app [web.1]:Error :找不到模块'pkginfo'2014-08-28T01:02:56.817349 + 00:00 app [web.1]:^ 2014-08-28T01:02:56.823915 + 00:00 app [web.1]:at Object .module._extensions..js(module.js:474:10)2014-08-28T01:02:56.823908 + 00:00 app [web.1]:at Module.require(module.js:364:17)2014 -08-28T01:02:56.823910 + 00:00 app [web.1]:at require(module.js:380:17)2014-08-28T01:02:56.823912 + 00:00 app [web.1]:在对象。 (/app/node_modules/passport-google-oauth/node_modules/passport-oauth/node_modules/passport/lib/passport/index.js:440:1)2014-08-28T01:02:56.823913 + 00:00 app [web (module.js:456:26)2014-08-28T01:02:56.823918 + 00:00 app [web.1]:at Function.Module._load(module.js:312: 12)2014-08-28T01:02:56.814921 + 00:00 app [web.1]:2014-08-28T01:02:56.838954 + 00:00 app [web.1]:error:永久检测到脚本退出:8 2014-08-28T01:02:56.815953 + 00:00 app [web.1]:throw err; 2014-08-28T01:02:56.823920 + 00:00 app [web.1]:at Module.require(module.js:364:17)2014-08-28T01:02:56.823917 + 00:00 app [web。 1]:在Module.load(module.js:356:32)2014-08-28T01:02:56.815545 + 00:00 app [web.1]:module.js:340

我已经按照Heroku网站上的所有步骤部署了节点,但一直在修复这个错误。 我可以在我的本地计算机上成功地做“工头启动”。 起初,做“工头开始”后,我得到了同样的错误“无法find模块'pkginfo',所以我安装了pkginfo在我的本地计算机上,然后工头开始工作,我可以启动我的应用程序localhost:5000没有任何问题。但是,仍然坚持在Heroku的服务器上修复这个错误。任何帮助?

谢谢! 贾森

你需要做的是在生产环境中安装软件包

1.进入你的主要应用程序目录

cd appDirectory

2.安装模块

npm install pkginfo

3.Re部署