在EC2实例中启动闪亮的应用程序时出错 [英] Error when launching shiny app in EC2 instance

查看:473
本文介绍了在EC2实例中启动闪亮的应用程序时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的EC2实例中有一个闪亮的应用程序设置.该应用程序很简单,并使用了我保存在S3存储桶(具有公共读取访问权限)中的CSV文件.有关安装程序的更多信息,请按照本文中的说明进行操作-

I have a shiny application setup in my EC2 instance. The application is simple, and uses a CSV file that I have saved in an S3 bucket (that has public read access). For more info on my setup, I followed the instructions in this article - https://aws.amazon.com/blogs/big-data/running-r-on-aws/ - to a dot, and I am able to deploy their demo app.

我的EC2实例上有RStudio服务器,并且我有运行该应用程序的代码,该应用程序保存在我的EC2实例中的适当位置(ec2-user/ShinyApps/myappnamehere/app.R.但是,当我尝试执行此操作时,使用我的闪亮应用程序访问该网址- http://ec2-MY-IP.compute-1.amazonaws.com:3838/ec2-user/myappname此处/,我在该网址上收到以下错误:

I have RStudio Server on my EC2 instance, and I have the code to run the app saved in the appropriate place in my EC2 instance (ec2-user/ShinyApps/myappnamehere/app.R. However, when I attempt to go to the url with my shiny app - http://ec2-MY-IP.compute-1.amazonaws.com:3838/ec2-user/myappnamehere/, I receive the following error at that url:

An error has occurred
The application failed to start.
The application exited during initialization.

这很奇怪,因为当我在控制台中从RStudio服务器中点击运行应用程序"时,该应用程序可以完美启动并正常运行.我已进入ec2-user/ShinyApps/log目录,并从尝试在线访问该应用程序时开始查看该日志文件,对此进行了调查,如下所示:

This is odd because when I hit 'run app' from RStudio Server in the console, the app launches perfectly and works fine. I've investigated by going into ec2-user/ShinyApps/log directory, and looking at the log file from when I attempted to visit the app online, and it is as follows:

su: ignore --preserve-environment, it's mutually exclusive to --login.
Error in library(RCurl) : there is no package called ‘RCurl’
Calls: runApp ... sourceUTF8 -> eval -> eval -> ..stacktraceon.. -> library
Execution halted

这很奇怪,因为是的,虽然library(RCurl)是我的代码中的一行(实际上是第二行),但是当我在RStudio Server中运行该代码时(整个应用程序正常工作).

This is odd because while, yes, library(RCurl) is a line in my code (the second line actually), THIS CODE WORKS (the whole app works) when I run it in RStudio Server.

任何对此为何不起作用的想法将不胜感激!

Any thoughts on why this might not be working would be greatly appreciated!

编辑-不确定这是否是这篇文章的最佳位置,因为它不在特定的代码行上-如果不是,请指出正确的方向.

EDIT - not sure if this is the best place for this post, since it isn't on a specific line of code - if not, please point me in the right direction.

推荐答案

要安装软件包,以便所有用户都可以使用它们.您需要以超级用户身份安装软件包.

To install packages so that they are available for all users. You need to install the packages as super-user.

首先,您想将R作为sudo运行.

First you want to run R as sudo.

我最好先将

sudo su

只需输入R即可运行运行R.

the run R by just typing R .

然后安装所需的所有软件包.

Then install all packages you need.

这将使所有安装的软件包对所有用户可用,包括闪亮的

This will make all installed packages available to all users including shiny

这篇关于在EC2实例中启动闪亮的应用程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆