简体   繁体   English

开发和生产之间不同的javascript行为

[英]Different javascript behaviour between development and production

I'm developing an application that at some point given some data draws a diagram using javascript allied with kineticJS framework. 我正在开发一个应用程序,该应用程序在某些时候提供了一些数据,并使用了与dynamicJS框架联合的javascript绘制了图表。

My problem is that in development everything works fine, but in production (heroku) does not work properly. 我的问题是,在开发中一切正常,但在生产中(heroku)无法正常工作。

Here is an example. 这是一个例子。 Given the same input data I get this on development: 给定相同的输入数据,我将在开发中得到以下信息:

在此处输入图片说明

But get this all messed up in production: 但是,在生产中将所有这些弄乱了:

在此处输入图片说明

I'm new at rails, I'm sure that something simple is missing, but I don't know what is missing. 我是Rails的新手,我敢肯定缺少一些简单的东西,但是我不知道缺少什么。

I have the javascript in the asset pipeline, and they are being compiled for production. 我在资产管道中有JavaScript,并且正在对其进行编译以进行生产。

在此处输入图片说明

Can this be caused by the pre-compilation done in the asset pipeline? 这可能是由于资产管道中的预编译引起的吗?

What is the best approach to debug this issues that happen in production? 调试生产中出现的此问题的最佳方法是什么?

I know I can use heroku logs for bugs more related with rails or ruby, but they don't help me debug this javascript different behaviour. 我知道我可以将heroku日志用于与Rails或ruby更相关的bug,但它们不能帮助我调试此javascript不同的行为。

Any help? 有什么帮助吗?

I would personally do a rake assets:precompile locally and run your rails server in production mode, this will allow you to debug the issue locally. 我个人会做一个rake assets:precompile在本地rake assets:precompile并在生产模式下运行rails服务器,这将允许您在本地调试问题。

RAILS_ENV=production rails s

If that doesn't help and you think it's a Heroku specific thing, hopefully this anecdote helps. 如果那无济于事,而您认为这是Heroku特有的事情,那么希望此事对您有所帮助。 I just ran into an issue where some of my views were using an environment variable, and found out that environment variables are not available to assets:precompile during the build phase unless you use a Heroku Buildpack. 我刚遇到一个问题,即我的某些视图正在使用环境变量,并且发现除非您使用Heroku Buildpack,否则在构建阶段环境变量不可用于asset:precompile。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM