Cloud9 で Laravel(v5.5.0) をインストールして Dusk を動かす方法


(1) Create workspace
Create workspace in Blank

(2) Installation of php 7.1

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install libapache2-mod-php7.1
sudo a2dismod php5
sudo a2enmod php7.1
sudo apt-get install php7.1-dom php7.1-mbstring php7.1-zip php7.1-mysql php7.1-sqlite
service apache2 restart

(3) Installation of Laravel (v5.5.0)

sudo composer self-update
sudo composer create-project --prefer-dist laravel/laravel ./laravel
shopt -s dotglob
sudo chown ubuntu:ubuntu * -hR
mv laravel/* ./
rm -rf laravel

(4) Apache setup

sudo vim /etc/apache2/sites-enabled/001-cloud9.conf
DocumentRoot /home/ubuntu/workspace
DocumentRoot /home/ubuntu/workspace/backend/public
sudo composer update

(5) Installation of Laravel Dusk

composer require --dev laravel/dusk
php artisan dusk:install

(6) Modifying .env

(7) Error countermeasure 01

php artisan serve & php artisan dusk

When you execute, at this point,

Error: Call to undefined function Facebook \ WebDriver \ Remote \curl_init ()

Will come out.

Because Facebook \ WebDriver version is old (v1.1.1).

Change the version of Facebook \ WebDriver to the latest (v1.4.1).

■Packagist – facebook/webdriver

(i) install curl
Since 1.1.2, ext-curl: * has been added to requires,
Install curl.

sudo apt-get install php7.1-curl

(ii)composer update

composer update

It went up to v1.4.1.

(8) Error countermeasure 02

php artisan serve & php artisan dusk

When you run it, this time

Facebook \ WebDriver \ Exception \ UnknownServerException: unknown error: can not find Chrome binary

Will come out.

I can not find a chrome binary.

Install chrome.

sudo wget -q -O - | sudo apt-key add -
sudo sh -c 'echo "deb stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost & php artisan serve & php artisan dusk

And, success! !

Once you run it, the process of Chrome and artisan serve will continue, so from next time,

php artisan dusk

Just it is executable.


Posted by dog-ears