railpack

Configure and troubleshoot Railpack builds, with emphasis on RAILPACK_* environment variables, railpack.json overlays, build-plan inspection, local CLI installation and usage, and local BuildKit containers. Use for Railpack provider configuration, custom install/build/start commands, Mise or Apt packages, build or runtime variables and secrets, generated-plan debugging, BUILDKIT_HOST errors, or running Railpack from a release or source checkout.

Install
npx skills add 'https://github.com/railwayapp/railpack/tree/main/.'
Incomplete bundle · no download
main · 21a254fScanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗

core/providers/node/cleanse.go

core/providers/node/cleanse.goBrowse 1970 files
View on GitHub
← Back to SKILL.md
// there are certain commands which `rm -rf node_modules`, which will cause a cache checksum docker error.// this cleanse operation imperfectly detects this case and removes node_modules from the cache keys to avoid this common user error.// more info here: https://github.com/railwayapp/railpack/pull/259 package node import (	"regexp" 	"github.com/railwayapp/railpack/core/plan") var (	npmCiCommandRegex      = regexp.MustCompile(`(?i)\bnpm\s+ci\b`)	removeNodeModulesRegex = regexp.MustCompile(`(?i)\b(?:rm\s+-r[f]?|rmdir|rimraf)\s+(?:\S*\/)?node_modules\b`)) func willRemoveNodeModules(commands []plan.Command) bool {	for _, cmd := range commands {		if execCmd, ok := cmd.(plan.ExecCommand); ok {			if npmCiCommandRegex.MatchString(execCmd.Cmd) || removeNodeModulesRegex.MatchString(execCmd.Cmd) {				return true			}		}	}	return false} func (p *NodeProvider) CleansePlan(buildPlan *plan.BuildPlan) {	var nodeModulesCacheKey string	for cacheName, cacheDef := range buildPlan.Caches {		if cacheDef.Directory == NODE_MODULES_CACHE {			nodeModulesCacheKey = cacheName			break		}	} 	if nodeModulesCacheKey == "" {		return	} 	for i, step := range buildPlan.Steps {		if step.Name == "install" || !willRemoveNodeModules(step.Commands) {			continue		} 		before := len(step.Caches)		if before == 0 {			continue		} 		var newCaches []string		for _, name := range step.Caches {			if name != "" && name != nodeModulesCacheKey {				newCaches = append(newCaches, name)			}		} 		buildPlan.Steps[i].Caches = newCaches	}}