Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ironyh's avatar
Level 10

HRM/dev server on Codespaces with Sail and Inertia.js

Hello!

So I've started to fiddle around with codespaces and I'm trying to start a npm dev server with inertia.js and laravel where I've added Jetstream, but it seems to fail. I don't really know where I should start looking to for a fix.

Every other time I get a 400 error and every other time I get a 504 error.

Found something about using .devcontainer to specify the app but when doing so even sail up fails. Does anyone have any suggestions?

0 likes
3 replies
Ironyh's avatar
Level 10

Just to make it clear:

sail npm run build 

works like a charm and compiles the js and adds it as it should and the page is rendered as it should. Witch is nice to see. But that's a bit timley to work with.

sail npm run dev

Returns the page but the includes:

http://localhost:5173/resources/js/app.js
http://localhost:5173/@vite/client

Returns empty responses with "ERR_EMPTY_RESPONSE" according to chrome,

I've tried to change the host dierctive to localhost or 127.0.0.1 or 0.0.0.0 without any sucess so I'm at a loss

EiYuuChile's avatar

Hello

You can make it? I want to run Laravel 10 with inertia in github codespaces but without success. I hope someone can help

Ironyh's avatar
Level 10

@EiYuuChile

I made a devcontainer {root-folder}/.devcontainer/.devcontainer file with something like this in it:

// https://aka.ms/devcontainer.json
{
	"name": "Existing Docker Compose (Extend)",
	"dockerComposeFile": [
		"../docker-compose.yml"
	],
	"service": "laravel.test",
	"workspaceFolder": "/workspaces/web",
	"customizations": {
		"vscode": {
			"extensions": [
				"bmewburn.vscode-intelephense-client",
				"EditorConfig.EditorConfig",
				"mikestead.dotenv",
				"amiralizadeh9480.laravel-extra-intellisense",
				"ryannaddy.laravel-artisan",
				"onecentlin.laravel5-snippets",
				"onecentlin.laravel-blade",
				"AmazonWebServices.aws-toolkit-vscode",
				"GitHub.copilot",
				"MehediDracula.php-namespace-resolver",
                "christian-kohler.path-intellisense"
			]
		},
        "settings": {
            "#terminal.integrated.shell.linux": "/usr/bin/zsh"
        }
	},

	"remoteUser": "sail",
	"postCreateCommand": "chown -R 1000:1000 /var/www/html"
	// "forwardPorts": [],
	// "runServices": [],
	// "shutdownAction": "none",
    //"features": {
    //    "ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {}
    //}
}

1 like

Please or to participate in this conversation.