Cloud9でLaravelのuiをインストール

これがどうしてもうまくいかない。
php artisan make:auth command-is-not-defined (Laravel 6)

laravel new project
cd project
composer require laravel/ui
php artisan ui vue --auth


何度やってもこうなる。

ec2-user:~/environment/project $ php artisan ui vue --auth

  Command "ui" is not defined.  

ec2-user:~/environment/project $ 

まず、プロジェクトフォルダの中でrequireしないといけない。
上のディレクトリで、インストールしてたから、アンインストールした。

ec2-user:~/environment $ composer remove laravel/ui
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 17 removals
  - Removing symfony/translation-contracts (v2.0.1)
  - Removing symfony/translation (v5.0.7)
  - Removing symfony/service-contracts (v2.0.1)
  - Removing symfony/process (v4.4.7)
  - Removing symfony/polyfill-php73 (v1.15.0)
  - Removing symfony/polyfill-mbstring (v1.15.0)
  - Removing symfony/finder (v4.4.7)
  - Removing symfony/console (v4.4.7)
  - Removing psr/simple-cache (1.0.1)
  - Removing psr/container (1.0.0)
  - Removing nesbot/carbon (2.32.2)
  - Removing laravel/ui (v1.2.0)
  - Removing illuminate/support (v6.18.8)
  - Removing illuminate/filesystem (v6.18.8)
  - Removing illuminate/contracts (v6.18.8)
  - Removing illuminate/console (v6.18.8)
  - Removing doctrine/inflector (1.3.1)
Generating autoload files
ec2-user:~/environment $ 


で、プロジェクトフォルダでインストールしようとしても、こうなる。

ec2-user:~/environment $ cd project/
ec2-user:~/environment/project $ composer require laravel/ui
Using version ^2.0 for laravel/ui
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install laravel/ui v2.0.1
    - Conclusion: don't install laravel/ui v2.0.0
    - Conclusion: remove laravel/framework v6.18.8
    - Installation request for laravel/ui ^2.0 -> satisfiable by laravel/ui[2.x-dev, v2.0.0, v2.0.1].
    - Conclusion: don't install laravel/framework v6.18.8

laravel/ui バージョン2はNGらしい。



バージョン1をインストールする。

ec2-user:~/environment/project $ composer require laravel/ui 1.*
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing laravel/ui (v1.2.0): 
Installation failed, reverting ./composer.json to its original content.
The following exception is caused by a lack of memory or swap, or not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details

PHP Warning:  proc_open(): fork failed - Cannot allocate memory in phar:///usr/bin/composer/vendor/symfony/console/Application.php on line 952

Warning: proc_open(): fork failed - Cannot allocate memory in phar:///usr/bin/composer/vendor/symfony/console/Application.php on line 952
                                                     
  [ErrorException]                                   
  proc_open(): fork failed - Cannot allocate memory  
                                                     

require [--dev] [--prefer-source] [--prefer-dist] [--fixed] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

メモリが割り当てられてないらしい。


メモリを割り当てる。

ec2-user:~/environment/project $ sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 13.1642 s, 81.6 MB/s
ec2-user:~/environment/project $ sudo /sbin/mkswap /var/swap.1
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=b8734b44-71ad-40cd-bf42-37a6c1bacea7
ec2-user:~/environment/project $ sudo /sbin/swapon /var/swap.1
swapon: /var/swap.1: insecure permissions 0644, 0600 suggested.
ec2-user:~/environment/project $ free -m
             total       used       free     shared    buffers     cached
Mem:           985        919         65          0          4        818
-/+ buffers/cache:         96        888
Swap:         1512        268       1243


再度、バージョン1をインストール

ec2-user:~/environment/project $ composer require laravel/ui 1.*
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing laravel/ui (v1.2.0): Loading from cache
Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: laravel/ui
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
11 packages you are using are looking for funding.
Use the `composer fund` command to find out more!


やっとうまく行くようになった。

ec2-user:~/environment/project $ php artisan ui vue --auth
Vue scaffolding installed successfully.
Please run "npm install && npm run dev" to compile your fresh scaffolding.
Authentication scaffolding generated successfully.
ec2-user:~/environment/project $