F
Filament10mo ago
Dhruva

npm run build is failing on github actions

I am encountering an issue with the npm run build command in github actions.
> build
> tsc && vite build && vite build --ssr

vite v4.5.1 building for production...
transforming...
Unable to resolve `@import "../../../../vendor/filament/filament/resources/css/theme.css"` from /home/runner/work/pinnacle/pinnacle/resources/css/filament/hq
✓ 4 modules transformed.
✓ built in 1.34s
[vite:css] [postcss] ENOENT: no such file or directory, open '../../../../vendor/filament/filament/resources/css/theme.css'
file: /home/runner/work/pinnacle/pinnacle/resources/css/filament/hq/theme.css:undefined:undefined
error during build:
Error: [postcss] ENOENT: no such file or directory, open '../../../../vendor/filament/filament/resources/css/theme.css'
Error: Process completed with exit code 1.
> build
> tsc && vite build && vite build --ssr

vite v4.5.1 building for production...
transforming...
Unable to resolve `@import "../../../../vendor/filament/filament/resources/css/theme.css"` from /home/runner/work/pinnacle/pinnacle/resources/css/filament/hq
✓ 4 modules transformed.
✓ built in 1.34s
[vite:css] [postcss] ENOENT: no such file or directory, open '../../../../vendor/filament/filament/resources/css/theme.css'
file: /home/runner/work/pinnacle/pinnacle/resources/css/filament/hq/theme.css:undefined:undefined
error during build:
Error: [postcss] ENOENT: no such file or directory, open '../../../../vendor/filament/filament/resources/css/theme.css'
Error: Process completed with exit code 1.
Below is my github action script
npm-build:
needs: build-and-test
name: 'Build NPM Assets'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: '18.x'
- name: Install dependencies
run: npm install
- name: Build Assets
run: npm run build
- name: Pull changes
run: git pull
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: 'staging'
commit_message: >
chore: build npm assets
npm-build:
needs: build-and-test
name: 'Build NPM Assets'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: '18.x'
- name: Install dependencies
run: npm install
- name: Build Assets
run: npm run build
- name: Pull changes
run: git pull
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: 'staging'
commit_message: >
chore: build npm assets
and my package.json
"scripts": {
"dev": "vite",
"build": "tsc && vite build && vite build --ssr",
"lint": "eslint . --ext js,jsx,ts,tsx",
"test": "vitest"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build && vite build --ssr",
"lint": "eslint . --ext js,jsx,ts,tsx",
"test": "vitest"
},
3 Replies
awcodes
awcodes10mo ago
you have to install laravel and filament in your job. similar to what you have to do for tests. otherwise the assets linked to in your css and tailwind.config.js can't find those files.
Dhruva
DhruvaOP10mo ago
@awcodes Thank you for your reply. I have added install composer dependencies in previous step. Kindly have a look on my yml file.
jobs:
build-and-test:
name: 'Build and Tests'
runs-on: ubuntu-latest
strategy:
fail-fast: true

steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '8.2'
- uses: actions/checkout@v3
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"

- name: Install Composer Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache

- name: Generate key
run: php artisan key:generate

- name: Clear Config and Cache
run: |
php artisan config:clear
php artisan cache:clear

- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite

- name: Run PEST
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: ./vendor/bin/pest

- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github

npm-build:
needs: build-and-test
name: 'Build NPM Assets'
runs-on: ubuntu-latest

jobs:
build-and-test:
name: 'Build and Tests'
runs-on: ubuntu-latest
strategy:
fail-fast: true

steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '8.2'
- uses: actions/checkout@v3
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"

- name: Install Composer Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache

- name: Generate key
run: php artisan key:generate

- name: Clear Config and Cache
run: |
php artisan config:clear
php artisan cache:clear

- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite

- name: Run PEST
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: ./vendor/bin/pest

- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github

npm-build:
needs: build-and-test
name: 'Build NPM Assets'
runs-on: ubuntu-latest

npm-build:
needs: build-and-test
name: 'Build NPM Assets'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Build Assets
run: npm run build
- name: Pull changes
run: git pull
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: 'staging'
commit_message: >
chore: build npm assets
npm-build:
needs: build-and-test
name: 'Build NPM Assets'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Build Assets
run: npm run build
- name: Pull changes
run: git pull
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: 'staging'
commit_message: >
chore: build npm assets
awcodes
awcodes10mo ago
hmm. at first glance that seems ok to me. i'm by no means a workflow expert though. wonder if npm ci would make a difference. just a guess though.
Want results from more Discord servers?
Add your server