Currently Available: Need a skilled Software Developer for your next project?
Categories
Laravel

Laravel Sail: npm install Hanging? Try This Simple Fix

When working with Laravel Sail, you might encounter an issue where npm install starts but never completes. The command appears to hang after downloading packages, with the spinner eventually stopping.

The Quick Solution

Run this command instead of the standard npm install:

sail npm install --prefer-offline --no-fund --no-audit

Why This Works

This combination of flags helps avoid common container-related issues:

  • --prefer-offline: Uses cached packages when available, reducing network dependencies
  • --no-fund: Skips funding messages that can cause delays
  • --no-audit: Bypasses the security vulnerability check that often hangs in containerized environments

Debugging Tips

If you're still experiencing issues:

  1. Add --verbose to see detailed progress
  2. Check container resources with docker stats
  3. Clear npm cache with sail npm cache clean --force
  4. Remove existing node_modules with sail bash -c "rm -rf node_modules"
What I'm building

Delegate tasks. Get software.

Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.

Take a look at vroni.com

Subscribe to my newsletter

Get new posts when I publish them.

I respect your privacy. Unsubscribe at any time.

Leave a Reply

Your email address will not be published. Required fields are marked *