本文介绍了在php Elastic Beanstalk环境中使用Node JS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用shell_exec来运行这样的节点应用程序:

I am trying to use shell_exec to run a node app like that:

shell_exec(node app.js) ;

但是我得到一个错误:sh:节点:找不到命令

But I got an error:sh: node: command not found

我已经尝试使用类似confing的文件来安装节点js:

I have tried to install node js using confing file like that:

commands:
  01_node_install:
    # run this command from /tmp directory
    cwd: /tmp
    # don't run the command if node is already installed (file /usr/bin/node exists)
    test: '[ ! -f /usr/bin/node ] && echo "node not installed"'
    # install from epel repository
    # flag -y for no-interaction installation
    command: 'yum install -y nodejs --enablerepo=epel'

这是我所有的env.config文件,但在Elastic Beanstalk日志中没有看到与此相关的任何内容,问题仍然存在.我怎么能从php环境中使用Node JS呢!

This was all of my env.config file but I don't see anything in the Elastic Beanstalk log related to that and the problem still exists.How could I use Node JS from php environment !!

推荐答案

您的配置文件很好.只需确保 env.config 位于项目根目录的 .ebextensions 文件夹中即可.

Your configuration file is fine. Just make sure that env.config is inside .ebextensions folder in the root directory of your project.

这篇关于在php Elastic Beanstalk环境中使用Node JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-29 07:32