R
Railway5mo ago
ThaWill

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

Only happens when I add the npm run build command, but I need it to generate the manifest.json. Variables -> NIXPACKS_BUILD_CMD
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
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
NIXPACKS_NO_CACHE = 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
#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
17 Replies
Percy
Percy5mo ago
Project ID: ddc402c7-4cc8-4fb1-bd35-90e685c893fc
ThaWill
ThaWillOP5mo ago
Brody
Brody5mo ago
im sorry but i wont be able to help unless you can provide logs generated by the bookmarklet
ThaWill
ThaWillOP5mo ago
The tool you shared its not working for me :cryingman:
Brody
Brody5mo ago
follow the instructions
ThaWill
ThaWillOP5mo ago
Ok, I think I got it Had to run it from the console
Brody
Brody5mo ago
send your package.json please
ThaWill
ThaWillOP5mo 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"
}
}
{
"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"
}
}
Brody
Brody5mo ago
move those dev dependencies to just a dependencies object
ThaWill
ThaWillOP5mo ago
The instance on railway is running now, its deploying 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.
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.
ThaWill
ThaWillOP5mo ago
No description
ThaWill
ThaWillOP5mo ago
App URL variable
No description
ThaWill
ThaWillOP5mo ago
This is how I reference the css in this view with Vite. <!-- Scripts --> @vite(['resources/css/app.css', 'resources/js/app.js']) And of course it works on local, idk what happens on production
Brody
Brody5mo ago
make sure you are loading your assets over https
Duchess
Duchess2d ago
New reply sent from Help Station thread:
Hi, could you fix the problem? I am having the same issue.
You're seeing this because this thread has been automatically linked to the Help Station thread.
Want results from more Discord servers?
Add your server