What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Quick question: ```> PhantomInstaller\Installer::installPhantomJS sh: /data/vendor/bin/phantomjs:

UQ958DA4U
UQ958DA4U Posts: 232 🧑🏻‍🚀 - Cadet
edited May 2020 in Help

Quick question:


I keep seeing this happening on different projects while running composer install. Is there any way to fix it?

Comments

  • UK5DS29L2
    UK5DS29L2 Posts: 546 🧑🏻‍🚀 - Cadet

    npm install first (or yarn install)

  • UK5DS29L2
    UK5DS29L2 Posts: 546 🧑🏻‍🚀 - Cadet

    this will install phantomjs

  • UK5DS29L2
    UK5DS29L2 Posts: 546 🧑🏻‍🚀 - Cadet

    which will allow composer postscripts to execute successfully

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice
    edited May 2020

    I would expect that this happens with docker/sdk, right?

  • UQ958DA4U
    UQ958DA4U Posts: 232 🧑🏻‍🚀 - Cadet

    Yes

  • UQ958DA4U
    UQ958DA4U Posts: 232 🧑🏻‍🚀 - Cadet

    @UK5DS29L2 Thanks for the tip! 'll give it a shot. However, I assumed that this was run through composer and not through npm? the error reporting could be a bit better if it was required to run npm install first.

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    It's about composer, yes.

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Let me bring here some internal discussions regarding the topic in a minute.

  • UQ958DA4U
    UQ958DA4U Posts: 232 🧑🏻‍🚀 - Cadet

    I mean it's not keeping me off doing anything, stuff works but I just found it a bit ... weird.

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice
    xxx
    One more annoying thing:
    every time I rundocker/sdk cli composer install -o
    PhantomJS is installed
    sh: /data/vendor/bin/phantomjs: not found
    Caught exception while checking PhantomJS version:
    Undefined offset: 0
      - Installing phantomjs (2.1.1): Downloading (100%)      
    I tried composer install inside cli - sme issue
    
    
    Mike Kalinin
    Does it have any impact?
    
    xxx
    slow comoser install 🙂
    
    Mike Kalinin
    It takes 2 seconds for me to install phantom.js…
    
    But anyway we do not need it in docker at all.
    
    So I would consider removing phantom.js from composer post-install.
    
    xxx
    but you cannot do this globally, many projects are still using vagrant.
    So it should be documented/explained or condiioned
    
    yyy
    @Mike Kalinin Am I right that we don’t use PhantomJS in docker environment and for client’s project I can safely remove it from my composer.json to get rid of installing it for every composer install?
    It causes a delay during gitlab pipeline run.
    
    Mike Kalinin  [15:46 Uhr]
    I am opened for suggestions. How to disable it in some envs?
    
    yyy
    Is it useful for this situation
    "scripts": {
        "post-install-cmd": [
             "[ $COMPOSER_DEV_MODE -eq 0 ] || <your command>"
        ]
    }
    
    
    <https://stackoverflow.com/questions/13087088/composer-run-scripts-only-in-dev-environment>
    
    What environment variable could be used in this situation, like $COMPOSER_DEV_MODE in this example?
    
    
    Mike Kalinin
    Actually we can use
    --no-scripts
    for prod-like mode that is actually used in CI.
    
    Mike Kalinin
    Good finding with COMPOSER_DEV_MODE
    
  • UQ958DA4U
    UQ958DA4U Posts: 232 🧑🏻‍🚀 - Cadet

    ok, gist is: I can just run --no-scripts in CI?

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    According to @ULYHPR789, yes.

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Or maybe it's just an assumption on how to fix the problem in future. I'm not sure. 🤔

  • UK5DS29L2
    UK5DS29L2 Posts: 546 🧑🏻‍🚀 - Cadet

    the problem with phantomjs is that it is often built for node, SOMETIMES repo doesnt' allow you to download some file which is not your fault.

  • UK5DS29L2
    UK5DS29L2 Posts: 546 🧑🏻‍🚀 - Cadet

    this could be prevented if the docker had the libvips installed so phantomjs can build itself from source

  • sprymiker
    sprymiker Cloud Platform Architect Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    docker/sdk does not need phantomjs in app container, separate container is used for E2E testing.

  • UK5DS29L2
    UK5DS29L2 Posts: 546 🧑🏻‍🚀 - Cadet

    that's ok, but you could make this not throw errors by modifying the docker image to keep the requirement consistent with docker/non-docker setup

  • UK5DS29L2
    UK5DS29L2 Posts: 546 🧑🏻‍🚀 - Cadet
    edited May 2020

    because it doesn't make sense to me to keep separate composer.json files for docker/non-docker

  • UK5DS29L2
    UK5DS29L2 Posts: 546 🧑🏻‍🚀 - Cadet

    and it doesn't hurt to adjust docker image slightly