edbizarro / gitlab-ci-pipeline-php

:coffee: Docker images for test PHP applications with Gitlab CI (or any other CI platform!)
https://hub.docker.com/r/edbizarro/gitlab-ci-pipeline-php
MIT License
528 stars 166 forks source link

[FAILED] npm run production: ERROR Failed to compile, These relative modules were not found #86

Closed Daniel-Mendes closed 4 years ago

Daniel-Mendes commented 4 years ago

So I have an error using your image, but I don't know why.

It fails with the job "build-assets" with the command npm run production.

Output:

ERROR  Failed to compile with 4 errors12:50:04 PM
These relative modules were not found:
 * ./components/Cards/Actor in ./resources/js/app.js
 * ./components/Cards/Episode in ./resources/js/app.js
 * ./components/Cards/Series in ./resources/js/app.js
 * ./components/Cards/User in ./resources/js/app.js

ERROR in ./resources/js/app.js
Module not found: Error: Can't resolve './components/Cards/Actor' in '/builds/checkshow/checkshow/resources/js'

My resources/js/app.js

Vue.component(
    'card-series',
    require('./components/cards/Series').default
);
Vue.component(
    'card-episode',
    require('./components/cards/Episode').default
);
Vue.component(
    'card-user',
    require('./components/cards/User').default
);
Vue.component(
    'card-actor',
    require('./components/cards/Actor').default
);

My .gitlab-ci.yml

stages:
  - preparation
  - building
  - syntax
  - testing
  - security
  - deploy

image: edbizarro/gitlab-ci-pipeline-php:7.4

variables:
  MYSQL_ROOT_PASSWORD: root
  MYSQL_USER: mysql_user
  MYSQL_PASSWORD: mysql_password
  MYSQL_DATABASE: mysql_db
  DB_HOST: mysql

cache:
  key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"

composer:
  stage: preparation
  script:
    - php --version
    - cp .env.testing .env
    - composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
    - php artisan key:generate
  artifacts:
    paths:
      - vendor/
      - .env
    expire_in: 1 days
    when: always
  cache:
    paths:
      - vendor/

npm:
  stage: preparation
  script:
    - npm --version
    - npm ci
  artifacts:
    paths:
      - node_modules/
    expire_in: 1 days
    when: always
  cache:
    paths:
      - node_modules/

build-assets:
  stage: building
  dependencies:
    - composer
    - npm
  script:
    - npm --version
    - npm run production
  artifacts:
    paths:
      - public/css/
      - public/js/
      - public/fonts/
      - public/mix-manifest.json
    expire_in: 1 days
    when: always