Erro na primeira vez que subi os containers
cjmz opened this issue · comments
Ao rodar a primeira vez o docker fez o build das imagens necessárias, porém, ao subir o container deu um problema para encontrar o cross-env
:
$ docker-compose up
WARNING: The Docker Engine you're using is running in swarm mode.
Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.
To deploy your application across the swarm, use `docker stack deploy`.
Creating network "phpsporgbr_default" with the default driver
Creating phpsporgbr_web_1 ... done
Attaching to phpsporgbr_web_1
web_1 | yarn run v1.16.0
web_1 | $ yarn dev --watch
web_1 | $ cross-env NODE_ENV=development yarn build --watch
web_1 | /bin/sh: 1: cross-env: not found
web_1 | error Command failed with exit code 127.
web_1 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
web_1 | error Command failed with exit code 127.
web_1 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
phpsporgbr_web_1 exited with code 127
Solução
Acessei o container direto por bash (docker-compose run --rm web bash)
e rodei o yarn
$ docker-compose run --rm web bash
www-data@64757b0d3e4f:/var/app$ yarn
yarn install v1.16.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > browser-sync-webpack-plugin@2.2.2" has unmet peer dependency "webpack@^1 || ^2 || ^3 || ^4".
warning " > sass-loader@7.1.0" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
[4/4] Building fresh packages...
warning Your current version of Yarn is out of date. The latest version is "1.17.3", while you're on "1.16.0".
info To upgrade, run the following command:
$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
Done in 14.06s.
$ exit
$ docker-compose up
WARNING: The Docker Engine you're using is running in swarm mode.
Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.
To deploy your application across the swarm, use `docker stack deploy`.
Starting phpsporgbr_web_1 ... done
Attaching to phpsporgbr_web_1
web_1 | yarn run v1.16.0
web_1 | $ yarn dev --watch
web_1 | $ cross-env NODE_ENV=development yarn build --watch
web_1 | $ webpack --progress --hide-modules --env=$NODE_ENV --config=node_modules/laravel-mix/setup/webpack.config.js --watch
web_1 | 10% building 1/1 modules 0 active
web_1 | webpack is watching the files…
web_1 |
98% after emitting SizeLimitsPlugin DONE Compiled successfully in 4238ms1:18:13 PM
web_1 |
web_1 | Could not find Jigsaw; please install it via Composer, either locally or globally.
web_1 | Done in 6.27s.
phpsporgbr_web_1 exited with code 0
Então apareceu outro problema Could not find Jigsaw; please install it via Composer, either locally or globally.
. Repeti o processo, só que agora rodando composer install
e também funcionou.
$ docker-compose run --rm web bash
www-data@8778af8bf3a3:/var/app$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 34 installs, 0 updates, 0 removals
- Installing malukenho/mcbumpface (0.1.3): Downloading (100%)
- Installing doctrine/inflector (v1.3.0): Downloading (100%)
- Installing erusev/parsedown (1.7.3): Downloading (100%)
- Installing hamcrest/hamcrest-php (v2.0.0): Downloading (100%)
- Installing symfony/translation-contracts (v1.1.5): Downloading (100%)
- Installing symfony/polyfill-mbstring (v1.11.0): Downloading (100%)
- Installing symfony/translation (v4.3.2): Downloading (100%)
- Installing nesbot/carbon (2.21.0): Downloading (100%)
- Installing psr/simple-cache (1.0.1): Downloading (100%)
- Installing psr/container (1.0.0): Downloading (100%)
- Installing illuminate/contracts (v5.8.28): Downloading (100%)
- Installing illuminate/support (v5.8.28): Downloading (100%)
- Installing illuminate/container (v5.8.28): Downloading (100%)
- Installing illuminate/events (v5.8.28): Downloading (100%)
- Installing symfony/finder (v4.3.2): Downloading (100%)
- Installing illuminate/filesystem (v5.8.28): Downloading (100%)
- Installing podentender/sitemap-generator (0.1.0): Downloading (100%)
- Installing psr/log (1.1.0): Downloading (100%)
- Installing symfony/debug (v4.3.2): Downloading (100%)
- Installing symfony/polyfill-php72 (v1.11.0): Downloading (100%)
- Installing symfony/polyfill-php73 (v1.11.0): Downloading (100%)
- Installing symfony/service-contracts (v1.1.5): Downloading (100%)
- Installing symfony/polyfill-ctype (v1.11.0): Downloading (100%)
- Installing phpoption/phpoption (1.5.0): Downloading (100%)
- Installing vlucas/phpdotenv (v3.4.0): Downloading (100%)
- Installing symfony/yaml (v4.3.2): Downloading (100%)
- Installing symfony/var-dumper (v4.3.2): Downloading (100%)
- Installing symfony/process (v4.3.2): Downloading (100%)
- Installing symfony/console (v4.3.2): Downloading (100%)
- Installing mockery/mockery (1.2.2): Downloading (100%)
- Installing mnapoli/front-yaml (1.6.0): Downloading (100%)
- Installing illuminate/view (v5.8.28): Downloading (100%)
- Installing erusev/parsedown-extra (0.7.1): Downloading (100%)
- Installing tightenco/jigsaw (v1.3.8): Downloading (100%)
symfony/translation suggests installing symfony/config
illuminate/support suggests installing moontoast/math (Required to use ordered UUIDs (^1.1).)
illuminate/support suggests installing ramsey/uuid (Required to use Str::uuid() (^3.7).)
illuminate/filesystem suggests installing league/flysystem (Required to use the Flysystem local and FTP drivers (^1.0).)
illuminate/filesystem suggests installing league/flysystem-aws-s3-v3 (Required to use the Flysystem S3 driver (^1.0).)
illuminate/filesystem suggests installing league/flysystem-cached-adapter (Required to use the Flysystem cache (^1.0).)
illuminate/filesystem suggests installing league/flysystem-rackspace (Required to use the Flysystem Rackspace driver (^1.0).)
illuminate/filesystem suggests installing league/flysystem-sftp (Required to use the Flysystem SFTP driver (^1.0).)
symfony/service-contracts suggests installing symfony/service-implementation
symfony/var-dumper suggests installing ext-intl (To show region name in time zone dump)
symfony/console suggests installing symfony/event-dispatcher
symfony/console suggests installing symfony/lock
Generating autoload files
$ docker-compose up
WARNING: The Docker Engine you're using is running in swarm mode.
Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.
To deploy your application across the swarm, use `docker stack deploy`.
Starting phpsporgbr_web_1 ... done
Attaching to phpsporgbr_web_1
web_1 | yarn run v1.16.0
web_1 | $ yarn dev --watch
web_1 | $ cross-env NODE_ENV=development yarn build --watch
web_1 | $ webpack --progress --hide-modules --env=$NODE_ENV --config=node_modules/laravel-mix/setup/webpack.config.js --watch
web_1 | 10% building 1/1 modules 0 active
web_1 | webpack is watching the files…
web_1 |
98% after emitting SizeLimitsPlugin DONE Compiled successfully in 4333ms1:39:07 PM
web_1 |
Asset Size Chunks Chunk Names
web_1 | /js/main.js 340 KiB /js/main [emitted] /js/main
web_1 | css/main.css 218 KiB /js/main [emitted] /js/main
web_1 | [Browsersync] Access URLs:
web_1 | -----------------------------------
web_1 | Local: http://localhost:3000
web_1 | External: http://172.23.0.2:3000
web_1 | -----------------------------------
web_1 | UI: http://localhost:3001
web_1 | UI External: http://localhost:3001
web_1 | -----------------------------------
web_1 | [Browsersync] Serving files from: build_development/
web_1 |
web_1 |
web_1 |
web_1 |
web_1 | Building development site
web_1 | Loading collections...
web_1 | Building files from source...
web_1 | Writing files to destination...
web_1 | Build time: 0.13 seconds
web_1 | Site build successfully!
web_1 |
web_1 | [Browsersync] Reloading Browsers...
Conclusão
Não sei se é um bug, depois que rodei o yarn
e o composer install
, mesmo excluindo as imagens e rodando docker system prune
não ocorreu novamente. Só aconteceu na primeira vez que rodei os containers no meu computador.
@cjmz, fico feliz que você tenha conseguido resolver o problema 😉
é mais ou menos o que está escrito aqui, só não sei se tá tão claro:
https://github.com/phpsp/phpsp.org.br/#avan%C3%A7ado
Po! É verdade, falha minha não ver lá então...
Tranquilo cara! Vou considerar que tá resolvido então!