【问题标题】:Deploying NodeJS/Babel/Grunt app on Heroku在 Heroku 上部署 NodeJS/Babel/Grunt 应用程序
【发布时间】:2016-09-22 11:55:11
【问题描述】:

我正在尝试在 Heroku 上部署我的项目。我已经能够heroku open 应用程序并看到它,但我在bundle.js 上得到一个 404。该应用程序位于 github here。该应用位于 heroku here

我已经尝试确保我的依赖项都存在于 babel、babelify、grunt 等方面。但我一定仍然缺少一些东西。

git push heroku 之后我没有收到任何错误,但我仍然收到 404。

【问题讨论】:

  • 您可以通过以下命令查看代码的日志详细信息:heroku logs -n 200

标签: node.js heroku gruntjs browserify babeljs


【解决方案1】:

我也可以在本地重新创建它。这是我运行您的 postinstall 脚本代码时得到的结果:

$ npm run postinstall

> ncps-mms@0.0.0 postinstall ncps-mms
> gulp transpile --gulpfile client/gulpfile.babel.js

[00:18:43] Requiring external module babel-register
[00:18:43] Working directory changed to ncps-mms/client
(node:30276) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[00:18:43] Using gulpfile ncps-mms/client/gulpfile.babel.js
[00:18:44] Starting 'transpile'...

Error:  Cannot find module './controllers/members-detail-controller' from 'ncps-mms/client/src'

[00:18:44] Finished 'transpile' after 184 ms

我看到了这个错误:

Error: Cannot find module './controllers/members-detail-controller' from 'ncps-mms/client/src'

缺少 members-detail-controller - 请参阅:https://github.com/gh0st/ncps-mms/tree/master/client/src/controllers

如果我注释掉以下行,https://github.com/gh0st/ncps-mms/blob/master/client/src/app.js#L4https://github.com/gh0st/ncps-mms/blob/master/client/src/app.js#L15 然后再次运行 npm run postinstall,gulp 任务运行没有错误。然后,我可以在 bundle.js 上没有 404 的情况下启动服务器。

【讨论】:

  • 所以运行 npm run watch 应该启动转译过程并观察源代码的变化。缺少的模块不是交易破坏者,没有它也可以编译/运行。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-09-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-05
相关资源
最近更新 更多