Heroku 在部署应用程序时未安装依赖项

ipa*_*yte 1 heroku node.js

iv 我的应用程序在 Heroku 上运行了一个月,今天我添加了登录功能。我推送了在本地计算机上运行良好的更新,但是当我在 heroku 上启动时,我收到错误消息

An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details
Run Code Online (Sandbox Code Playgroud)

这是我在 heroku 控制台上遇到的错误:

           ^
2014-08-23T03:33:15.894737+00:00 app[web.1]:     at Function.Module._load (module.js:280:25)
2014-08-23T03:33:15.694754+00:00 app[web.1]: > application-name@0.0.1 start /app
2014-08-23T03:33:15.694756+00:00 app[web.1]: > node ./bin/www
2014-08-23T03:33:15.892108+00:00 app[web.1]: 
2014-08-23T03:33:15.892717+00:00 app[web.1]:     throw err;
2014-08-23T03:33:15.894741+00:00 app[web.1]:     at require (module.js:380:17)
2014-08-23T03:33:15.894747+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:474:10)
2014-08-23T03:33:15.894731+00:00 app[web.1]: Error: Cannot find module 'mongoose/'
2014-08-23T03:33:15.894734+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:338:15)
2014-08-23T03:33:15.894739+00:00 app[web.1]:     at Module.require (module.js:364:17)
2014-08-23T03:33:15.894753+00:00 app[web.1]:     at Module.require (module.js:364:17)
2014-08-23T03:33:15.894743+00:00 app[web.1]:     at Object.<anonymous> (/app/app.js:7:16)
2014-08-23T03:33:15.894749+00:00 app[web.1]:     at Module.load (module.js:356:32)
2014-08-23T03:33:15.901426+00:00 app[web.1]: 
2014-08-23T03:33:15.894745+00:00 app[web.1]:     at Module._compile (module.js:456:26)
2014-08-23T03:33:15.894751+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
2014-08-23T03:33:14.758661+00:00 heroku[web.1]: Starting process with command `npm start`
2014-08-23T03:33:16.526792+00:00 heroku[web.1]: Process exited with status 1
Run Code Online (Sandbox Code Playgroud)

这没有任何意义,因为我已经有了猫鼬,并且app.js自从我第一次部署它以来就一直坐着,没有任何问题!呃。

这仅在我尝试推送新更新时才开始,也许是因为我将我的 mac 更新到了yosemite

我已经尝试了我在网上看到的所有方法,但似乎没有任何效果,例如(heroku restart)有什么想法吗?

额外信息: 部署应用程序时,这是我在终端中得到的内容:

-----> Defaulting to latest stable node: 0.10.31
-----> Downloading and installing node
-----> Restoring node_modules directory from cache
-----> Pruning cached dependencies not specified in package.json
-----> Exporting config vars to environment
-----> Installing dependencies
-----> Caching node_modules directory for future builds
-----> Cleaning up node-gyp and npm artifacts
-----> No Procfile found; Adding npm start to new Procfile
-----> Building runtime environment
-----> Discovering process types
       Procfile declares types -> web

-----> Compressing... done, 8.6MB
-----> Launching... done, v27
       http://nefs.herokuapp.com/ deployed to Heroku
Run Code Online (Sandbox Code Playgroud)

亲切的问候

Anu*_*sht 5

我面临着同样的问题。第一次安装依赖项。之后,我对 package.json 的更改没有反映在 Heroku 应用程序中。

这主要是由于两个原因

  1. Heroku 正在缓存 node_modules
  2. Heroku 在生产模式下运行并忽略了 devDependency。

请参阅下面的链接,我在其中分享了如何解决这两个问题。

/sf/answers/3155138381/