How to install playwright in elastic beanstalk via .ebextensions?

0

I need to install Playwright in my Elastic beanstalk. So, I am using this command in .ebextensions

.ebextensions/01_install_playwright.config

container_commands:
  install_playwright: 
    command: "npx playwright install --with-deps chromium"

But it's getting error out. Here are the logs from cfn-init.log -

2022-09-29 05:16:17,188 [INFO] -----------------------Starting build-----------------------
2022-09-29 05:16:17,194 [INFO] Running configSets: Infra-EmbeddedPostBuild
2022-09-29 05:16:17,197 [INFO] Running configSet Infra-EmbeddedPostBuild
2022-09-29 05:16:17,200 [INFO] Running config postbuild_0_test_worker
2022-09-29 05:16:18,246 [ERROR] Command install_playwright (npx playwright install --with-deps chromium) failed
2022-09-29 05:16:18,246 [ERROR] Error encountered during build of postbuild_0_test_worker: Command install_playwright failed
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 576, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 276, in build
    self._config.commands)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
    raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command install_playwright failed
2022-09-29 05:16:18,247 [ERROR] -----------------------BUILD FAILED!------------------------
2022-09-29 05:16:18,247 [ERROR] Unhandled exception during build: Command install_playwright failed
Traceback (most recent call last):
  File "/opt/aws/bin/cfn-init", line 176, in <module>
    worklog.build(metadata, configSets)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 137, in build
    Contractor(metadata).build(configSets, self)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 564, in build
    self.run_config(config, worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 576, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 276, in build
    self._config.commands)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
    raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command install_playwright failed

Am I missing something or any suggestion on how to run the npx command on .ebextensions. I also posted on SO but didn't see any response.

While everything is working fine on code pipeline using buildspec.yml and same command

phases:
  install:
    runtime-versions:
      nodejs: 16  
      #nodejs: latest  
  pre_build:
    commands:      
      - echo Installing source NPM dependencies...
      - npm install
      - echo Installing Chromium...
      - npx playwright install --with-deps chromium
vikash
已提問 1 年前檢視次數 95 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南