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

abzolute's avatar

Trouble Installing Spark

I created a server using laravel forge. I installed the latest node and composer. I installed the spark installer and registered a token. When I run: spark new myapp This happens:

forge@myserver:~$ spark new myapp
sh: 1: laravel: not found
Downloading Spark...
PHP Warning:  file_put_contents(/home/forge/myapp/spark-archive.zip): failed to open stream: No such file or directory in /home/forge/.config/composer/vendor/laravel/spark-installer/src/Installation/DownloadSpark.php on line 59

Warning: file_put_contents(/home/forge/myapp/spark-archive.zip): failed to open stream: No such file or directory in /home/forge/.config/composer/vendor/laravel/spark-installer/src/Installation/DownloadSpark.php on line 59
PHP Warning:  ZipArchive::extractTo(): Invalid or uninitialized Zip object in /home/forge/.config/composer/vendor/laravel/spark-installer/src/Installation/DownloadSpark.php on line 105

Warning: ZipArchive::extractTo(): Invalid or uninitialized Zip object in /home/forge/.config/composer/vendor/laravel/spark-installer/src/Installation/DownloadSpark.php on line 105
PHP Warning:  ZipArchive::close(): Invalid or uninitialized Zip object in /home/forge/.config/composer/vendor/laravel/spark-installer/src/Installation/DownloadSpark.php on line 107

Warning: ZipArchive::close(): Invalid or uninitialized Zip object in /home/forge/.config/composer/vendor/laravel/spark-installer/src/Installation/DownloadSpark.php on line 107
PHP Notice:  Undefined offset: 0 in /home/forge/.config/composer/vendor/laravel/spark-installer/src/Installation/DownloadSpark.php on line 120

Notice: Undefined offset: 0 in /home/forge/.config/composer/vendor/laravel/spark-installer/src/Installation/DownloadSpark.php on line 120
PHP Warning:  file_get_contents(/home/forge/myapp/composer.json): failed to open stream: No such file or directory in /home/forge/.config/composer/vendor/laravel/spark-installer/src/Installation/UpdateComposerFile.php on line 54

Warning: file_get_contents(/home/forge/myapp/composer.json): failed to open stream: No such file or directory in /home/forge/.config/composer/vendor/laravel/spark-installer/src/Installation/UpdateComposerFile.php on line 54
0 likes
3 replies
ejdelmonico's avatar
Level 53

Its easier to just clone repo and run composer update, npm install, etc. That is what I did. I had to deploy a second time and everything worked. Oh, don't forget .env values. In short, I never ran an install command.

jivemonkey's avatar

Now, this was a while ago I know, but I ran into the same problem and really wanted to use the Spark installer, for my own peace of mind.

As it's the first Google result, I thought I'd give the correct solution.

The problem lies in the creation of the fresh Laravel application in the Spark installer, the first line error gave it away:

sh: 1: laravel: not found

This is due to the global composer bin folder not being in the PATH variable, and therefore the laravel new ... can't run to scaffold the fresh application. To add it temporarily for the current session, run the following:

export PATH="$PATH:$HOME/.config/composer/vendor/bin"

Following which, spark new myapp will now run.

Note: Global composer bin directory may differ from above, which is from a Forge server.

2 likes
Nicholaus's avatar

I'm on Forge, and after I added the following two lines to the bottom of my .bashrc file and restarted my session, everything worked:

# Laravel Installer
export PATH="$PATH:$HOME/.config/composer/vendor/bin"

# Spark Installer
export PATH="$PATH:/home/forge/spark-installer/"
1 like

Please or to participate in this conversation.