Open adrienlamotte opened 3 years ago
Hi Adrien!
I just encountered this issue and it was due to invalid Yarn cache in my home directory. Perhaps is it linked here too?
Hello @adrienlamotte, @tgalopin 👋
I found myself faced with the same problem, the "node build stage" of the assets requires having the vendor directory present due to the definition of the ux-chartjs in the package.json file
"@symfony/ux-chartjs" : "file:vendor/symfony/ux-chartjs/Resources/assets"
For this, I added a "composer" build step that I then copy into my node and php stage as follows:
ARG PHP_VERSION=8.1
ARG CADDY_VERSION=2
ARG NODE_VERSION=17
ARG COMPOSER_VERSION=2
# ==========================================================================================
# --- COMPOSER ---
# ==========================================================================================
FROM composer:${COMPOSER_VERSION} AS symfony_composer
WORKDIR /srv/app
COPY composer.json composer.lock symfony.lock ./
RUN composer install --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress;
# ==========================================================================================
# --- NODE ---
# ==========================================================================================
FROM node:${NODE_VERSION}-alpine AS symfony_node
WORKDIR /srv/app
COPY package*.json ./
## Here copy vendor directory needed for ux-chartjs build on assets build.
COPY --from=symfony_composer /srv/app/vendor vendor/
RUN yarn install
## copy everything to use PostCSS, Tailwinds, webpack, ...
COPY . .
RUN yarn run build
# ==========================================================================================
# --- PHP ---
# ==========================================================================================
FROM php:${PHP_VERSION}-fpm-alpine AS symfony_php
// ...
COPY --from=symfony_composer /usr/bin/composer /usr/bin/composer
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PATH="${PATH}:/root/.composer/vendor/bin"
WORKDIR /srv/app
COPY --from=symfony_node /srv/app/public/build public/build
ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]
I think there is better to do, that's why I share my solution with you.
Error: The file "@symfony/ux-swup/package.json" could not be found.
when a tried to build with npm run build
after install Symfony UX Swup"@symfony/ux-swup": "file:vendor/symfony/ux-swup/Resources/assets"
on my package.json
file.vendor/symfony/ux-swup/
, i noticed that i didn't have Ressource
directory
"@symfony/ux-swup": "file:vendor/symfony/ux-swup/assets"
I have a docker for my Symfony 5 project, but I can't make it work with @symfony/ux-swup. When I try to build with
npm run build
, I have the error bellow in Docker :Here is my docker file relevant parts :
I have noticed that in the package.js, ux-swup il referenced by :
Not sure if this might cause the problem...
Any clues? Thanks!