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

mattltm's avatar

Installing Spark on Homestead (VirtualBox on Windows 10)

I'm attempting to install Spark in a Homestead VM on my Windows 10 machine.

When I run:

spark new projectname

everything runs fine until the compile assets part:

 Would you like to compile your assets? (yes/no) [yes]:
 >
Running Build Script...
> @ dev /home/vagrant/code/projectname
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

sh: 1: cross-env: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! @ dev: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2019-09-22T10_58_35_018Z-debug.log
vagrant@homestead:~/code$

I've tried:

npm install --no-bin-links

and

npm rebuild

but whenever I run:

npm run dev

I get the cross-env not found error.

Can anyone see what I am doing wrong?

0 likes
6 replies
TerrePorter's avatar

Have you installed the package?

npm install --global cross-env

mattltm's avatar

Yes, I've tried that a few times. Thanks.

TerrePorter's avatar

@mattltm not sure what else to try, maybe just scrap that node install and make a fresh one.

Cronix's avatar

Try the composer method for installing. You've ssh'd into the homestead box when running these commands?

mattltm's avatar

Yes, I run the commands on a fresh Homestead box and they fail every time. It always gets to compile the assets then fails.

mattltm's avatar

Another try, another problem...

This time, a fresh Homestead VM. Following all of the official instructions and have tried both the spark-installer and installing via composer.

Now I'm getting this error

Class 'Laravel\Spark\Providers\SparkServiceProvider' not found

I've tried all the usuals:

rm -rf vendor
composer install
composer update

I've checked to see the /vendor/laravel/spark folder exists (it doesn't).

Seems like everytime I try and install spark, it fails in some new and exciting way!

Please or to participate in this conversation.