Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony/UX-autocomplete npm package not installable in docker container #1233

Closed
4d4ch4u32 opened this issue Oct 27, 2023 · 3 comments
Closed
Labels
Bug Bug Fix Status: Needs Review Needs to be reviewed

Comments

@4d4ch4u32
Copy link

4d4ch4u32 commented Oct 27, 2023

Symfony version(s) affected

6.3.6

Description

When running yarn install inside a Docker container (FROM php:8.2-fpm-alpine), I encountered the following error:

3.520 error Package "" refers to a non-existing file '"/srv/app/vendor/symfony/ux-autocomplete/assets"'.
3.520 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Here's the relevant section of the Dockerfile:

RUN apk add npm &&  \
    corepack enable && \
    yarn install && \
    yarn build

Here's the contents of the package.json file:

{
  "devDependencies": {
    "@babel/core": "^7.22.9",
    "@babel/preset-env": "^7.22.9",
    "@hotwired/stimulus": "^3.0.0",
    "@playwright/test": "^1.36.2",
    "@popperjs/core": "^2.11.8",
    "@symfony/stimulus-bridge": "^3.2.0",
    "@symfony/ux-autocomplete": "file:vendor/symfony/ux-autocomplete/assets",
    "@symfony/webpack-encore": "^4.4.0",
    "core-js": "^3.32.0",
    "jquery": "^3.7.0",
    "regenerator-runtime": "^0.13.11",
    "sass": "^1.64.2",
    "sass-loader": "^13.3.2",
    "tom-select": "^2.2.2",
    "webpack": "^5.88.2",
    "webpack-cli": "^5.1.4",
    "webpack-notifier": "^1.15.0"
  },
  "license": "UNLICENSED",
  "private": true,
  "scripts": {
    "dev-server": "encore dev-server",
    "dev": "encore dev",
    "watch": "encore dev --watch",
    "build": "encore production --progress",
    "e2e": "playwright test"
  },
  "dependencies": {
    "@fortawesome/fontawesome-pro": "^6.4.2",
    "bootstrap": "5.2.2",
    "bootstrap-icons": "^1.10.5",
    "countdown": "^2.6.0",
    "flag-icon-css": "^4.1.7",
    "fslightbox": "^3.4.1",
    "list.js": "^2.3.1",
    "shufflejs": "^6.1.0",
    "swiper": "^10.1.0",
    "trix": "^2.0.7",
    "typed.js": "^2.0.16"
  }
}

"symfony/ux-autocomplete": "^2.12" is added to the composer.json file in the require section.

How to reproduce

It should be reproducable by using the configuration from the description and try to build the docker container.

Possible Solution

No response

Additional Context

When I run yarn install inside the container, it works without any problem and the symfony ux autocomplete component works.

@4d4ch4u32 4d4ch4u32 added the Bug Bug Fix label Oct 27, 2023
@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Oct 27, 2023
@nicolas-grekas nicolas-grekas transferred this issue from symfony/symfony Oct 27, 2023
@WebMamba
Copy link
Collaborator

I think it's something with your docker volumes. You may have your yarn.lock share between your local env and your container but not your node-modules.

@4d4ch4u32
Copy link
Author

4d4ch4u32 commented Oct 27, 2023

The problem was that the composer packages needed to be installed before running yarn install. Rearranging the order in the Dockerfile resolved the issue.

See "@symfony/ux-autocomplete": "file:vendor/symfony/ux-autocomplete/assets", in package.json.

@WebMamba
Copy link
Collaborator

Ha yes good catch! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug Fix Status: Needs Review Needs to be reviewed
Projects
None yet
Development

No branches or pull requests

3 participants