npm run build doesn't work, Laravel 11 + Vite

AnonymousTRIAL

a year ago

Only happens when I add the npm run build command, but I need it to generate the manifest.json.

Variables ->

NIXPACKSBUILDCMD

composer install && npm install --production && npm run build && php artisan optimize && php artisan config:cache && php artisan route:cache && php artisan view:cache && php artisan migrate --force

NIXPACKSNOCACHE = 1

Logs:

#15 3.701 sh: 1: vite: not found

#15 ERROR: process "/bin/bash -ol pipefail -c composer install && npm install --production && npm run build && php artisan optimize && php artisan config:cache && php artisan route:cache && php artisan view:cache && php artisan migrate --force" did not complete successfully: exit code: 127

-----

> [11/12] RUN  composer install && npm install --production && npm run build && php artisan optimize && php artisan config:cache && php artisan route:cache && php artisan view:cache && php artisan migrate --force:

WARN config production Use `--omit=dev` instead.

3.480

3.480 up to date, audited 1 package in 591ms

3.481

3.481 found 0 vulnerabilities

3.695

3.695 > build

3.695 > vite build

3.695

3.701 sh: 1: vite: not found

-----

Dockerfile:25

-------------------

23 |     # build phase

24 |     COPY . /app/.

25 | >>> RUN  composer install && npm install --production && npm run build && php artisan optimize && php artisan config:cache && php artisan route:cache && php artisan view:cache && php artisan migrate --force

26 |

27 |

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c composer install && npm install --production && npm run build && php artisan optimize && php artisan config:cache && php artisan route:cache && php artisan view:cache && php artisan migrate --force" did not complete successfully: exit code: 127



Error: Docker build failed

2 Replies

AnonymousTRIAL

a year ago

ddc402c7-4cc8-4fb1-bd35-90e685c893fc


a year ago

full build logs please -


AnonymousTRIAL

a year ago


a year ago

im sorry but i wont be able to help unless you can provide logs generated by the bookmarklet


AnonymousTRIAL

a year ago

The tool you shared its not working for me <:cryingman:786867299553378324>


a year ago

follow the instructions


AnonymousTRIAL

a year ago

Ok, I think I got it


AnonymousTRIAL

a year ago

Had to run it from the console


AnonymousTRIAL

a year ago


a year ago

send your package.json please


AnonymousTRIAL

a year ago

{
    "private": true,
    "type": "module",
    "scripts": {
        "dev": "vite",
        "build": "vite build"
    },
    "devDependencies": {
        "@tailwindcss/forms": "^0.5.2",
        "alpinejs": "^3.4.2",
        "autoprefixer": "^10.4.2",
        "axios": "^1.6.4",
        "laravel-vite-plugin": "^1.0",
        "postcss": "^8.4.31",
        "tailwindcss": "^3.1.0",
        "vite": "^5.0"
    }
}

a year ago

move those dev dependencies to just a dependencies object


AnonymousTRIAL

a year ago

The instance on railway is running now, its deploying


AnonymousTRIAL

a year ago

But now it doesn't load the CSS.

Dev Tools Terminal Error

Mixed Content: The page at 'https://library-php-production-1bc2.up.railway.app/login' was loaded over HTTPS, but requested an insecure stylesheet 'http://library-php-production-1bc2.up.railway.app/build/assets/app-6MzHoY9L.css'. This request has been blocked; the content must be served over HTTPS.

AnonymousTRIAL

a year ago

1255977876797259800


AnonymousTRIAL

a year ago

App URL variable

1255978708368494600


AnonymousTRIAL

a year ago

This is how I reference the css in this view with Vite.

@vite(['resources/css/app.css', 'resources/js/app.js'])


AnonymousTRIAL

a year ago

And of course it works on local, idk what happens on production


a year ago

make sure you are loading your assets over https


juniorovTRIAL

7 months ago

Hi, could you fix the problem? I am having the same issue.


alucard079TRIAL

5 months ago

Hello, were you able to deploy your laravel 11 app?