Slim Application Error - installation of Shopware 6 on local computer

Problem with installations of Shopware 6 on local computer - XAMPP, Laragon

In downloaded the Shopware 6 archive last version from Shopware website.

Before installation Shopware shows all necessary parameters GREEN.

During installation, after DB configuration - ERROR

Slim Application Error
The application could not run because of the following error:

Details
Type: TypeError
Message: openssl_pkey_get_details() expects parameter 1 to be resource, boolean given
File: E:\laragon\www\shopware6\public\recovery\common\src\Service\JwtCertificateService.php
Line: 30
Trace
#0 E:\laragon\www\shopware6\public\recovery\common\src\Service\JwtCertificateService.php(30): openssl_pkey_get_details(false)
#1 E:\laragon\www\shopware6\public\recovery\install\src\app.php(323): Shopware\Recovery\Common\Service\JwtCertificateService->generate()
#2 [internal function]: Closure->{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#3 E:\laragon\www\shopware6\public\recovery\common\vendor\slim\slim\Slim\Handlers\Strategies\RequestResponse.php(41): call_user_func(Object(Closure), Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#4 E:\laragon\www\shopware6\public\recovery\common\vendor\slim\slim\Slim\Route.php(356): Slim\Handlers\Strategies\RequestResponse->__invoke(Object(Closure), Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#5 E:\laragon\www\shopware6\public\recovery\common\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(117): Slim\Route->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#6 E:\laragon\www\shopware6\public\recovery\common\vendor\slim\slim\Slim\Route.php(334): Slim\Route->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#7 E:\laragon\www\shopware6\public\recovery\common\vendor\slim\slim\Slim\App.php(515): Slim\Route->run(Object(Slim\Http\Request), Object(Slim\Http\Response))
#8 E:\laragon\www\shopware6\public\recovery\install\src\app.php(154): Slim\App->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#9 [internal function]: Closure->{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))
#10 E:\laragon\www\shopware6\public\recovery\common\vendor\slim\slim\Slim\DeferredCallable.php(43): call_user_func_array(Object(Closure), Array)
#11 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))
#12 E:\laragon\www\shopware6\public\recovery\common\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))
#13 E:\laragon\www\shopware6\public\recovery\common\vendor\slim\slim\Slim\MiddlewareAwareTrait.php(117): Slim\App->Slim\{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))
#14 E:\laragon\www\shopware6\public\recovery\common\vendor\slim\slim\Slim\App.php(405): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#15 E:\laragon\www\shopware6\public\recovery\common\vendor\slim\slim\Slim\App.php(313): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
#16 E:\laragon\www\shopware6\public\recovery\install\index.php(51): Slim\App->run()
#17 {main}

Warning: openssl_pkey_export_to_file(): cannot get key from parameter 1 in E:\laragon\www\shopware6\public\recovery\common\src\Service\JwtCertificateService.php on line 27

I tried to fix it by setting declare(strict_types=0);

in \public\recovery\common\src\Service\JwtCertificateService.php

This made possible to do the installation but after installation in backend I see this error:

{
"errors": [
 {
  "code": "0",
  "status": "500",
  "title": "Internal Server Error",
  "detail": "Key path 
  \"file://E:\\laragon\\www\\shopware6/config/jwt/private.pem\" does 
  not exist or is not readable"
 }
]
}

and in FrontEnd is also error:

Fatal error: Uncaught LogicException: Key path "file://E:\laragon\www\shopware6/config/jwt/private.pem" does not exist or is not readable in E:\laragon\www\shopware6\vendor\league\oauth2-server\src\CryptKey.php:48 Stack trace: #0 E:\laragon\www\shopware6\var\cache\prod_k379092f7_pd41d8cd9\ContainerQxQUHDs\srcShopware_Production_KernelProdContainer.php(3278): League\OAuth2\Server\CryptKey->__construct('file://E:\\larag...', 'shopware') #1 E:\laragon\www\shopware6\var\cache\prod_k379092f7_pd41d8cd9\ContainerQxQUHDs\srcShopware_Production_KernelProdContainer.php(2660): ContainerQxQUHDs\srcShopware_Production_KernelProdContainer->getShopware_Api_AuthorizationServerService() #2 E:\laragon\www\shopware6\var\cache\prod_k379092f7_pd41d8cd9\ContainerQxQUHDs\srcShopware_Production_KernelProdContainer.php(1870): ContainerQxQUHDs\srcShopware_Production_KernelProdContainer->getApiAuthenticationListenerService() #3 E:\laragon\www\shopware6\vendor\symfony\event-dispatcher\EventDispatcher.php(296): ContainerQxQUHDs\srcShopware_Production in E:\laragon\www\shopware6\vendor\league\oauth2-server\src\CryptKey.php on line 48

I tried to create manually the missing file config/jwt/private.pem. After that I got access to admin login page but the login and password are not accepted!! The front end is is for small devices and is  broken.

A tried with different versions of PHP 7.2.22, 7.3.9 and with MySQL 5.7.24 and MariaDB 10.3.17. The problem is the same for all versions.

Is there any possibility to install on my computer Shopware 6?

 

Shopware 5 and 6 won’t work properly on a windows based system. You should definitly use a unix based (Linux, MacOS) operation system for your local environment. This can be done by using e.g. a virtual box VM: Shopware 6 - Setting Up a Local Environment with Virtual Box

There is no official windows support and you will face multiple issues by using windows. 

Thank you!

I tried shopware 5.6 with Vagrant and Virtual Box and it works very very slow!!

Do you have any working solution with Docker Container ? 

 

Why should it be slow? I get 200ms for the frontend in the virtual box image!
Seems more like an issue with the resources on your computer.

You can use docker, too. But docker itself is not designed to be used on windows, since it is a linux based software. You can try it, but I don’t think it will work properly, since file-system access is different on windows hosts: https://docs.shopware.com/en/shopware-platform-dev-en/getting-started/installation-guide#docker-installation-recommended

I mean, Docker with Virtual Box on Windows.

I am not using Docker directly on Windows because it needs Hyper-V to be ON. If it is ON then VirtualBox will not work and this is not good solution for me.

I use Virtual box for CentOS + Plesk tests before we do something on real server, for work with Vagrant…  

The Processor on my Laptop is up to 3.7Ghz, 4 Physical Cores ( 8 Virtual), RAM - 32Gb. It was set especially for work with Virtual Machines and CentOS + Plesk runs at quite fast. 

Now I am looking for a normal dev environment for Shopware development. I hoped that this one https://github.com/shopwareLabs/shopware-vagrant will be the sollution but I am very dissapointed. It’s very slow. MUCH slower then XAMPP and Laragon. I think, there is something wrong with this box. You can see there the Vagrantfile settings.

 

Have you tried the one from the link above?

Yes, I tried

➜  shopware6  git clone git@github.com:shopware/development.git
Cloning into ‘development’…
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Where did you get this error message?

There is a script inside the VM that handles the installation, you need to connect via putty to run it. As described here: Shopware 6 - Setting Up a Local Environment with Virtual Box

Ok, thank! I will try it.

I tried the first version, Ubuntu on VirtualBox and then Shopware 6 installation.

Everuthing went ok up to the end of installation where there where some errors  and the installtation stopped.

Here is the log from terminal where errors started

 gyp ERR! configure error
        gyp ERR! stack Error: EACCES: permission denied, mkdir '/var/www/html/sw6/vendor/shopware/platform/src/Storefront/Resources/node_modules/node-sass/build'
        gyp ERR! System Linux 4.15.0-60-generic
        gyp ERR! command "/usr/bin/node" "/var/www/html/sw6/vendor/shopware/platform/src/Storefront/Resources/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
        gyp ERR! cwd /var/www/html/sw6/vendor/shopware/platform/src/Storefront/Resources/node_modules/node-sass
        gyp ERR! node -v v8.10.0
        gyp ERR! node-gyp -v v3.8.0
        gyp ERR! not ok
        Build failed with error code: 1
        npm ERR! code ELIFECYCLE
        npm ERR! errno 1
        npm ERR! node-sass@4.12.0 postinstall: `node scripts/build.js`
        npm ERR! Exit status 1
        npm ERR!
        npm ERR! Failed at the node-sass@4.12.0 postinstall 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/anatol/.npm/_logs/2019-09-02T18_40_37_816Z-debug.log

Execution aborted, a subcommand failed!

I followed precisely the instucion https://docs.shopware.com/en/shopware-6-en/tutorials-and-faq/virtual-box-setup?_ga=2.176919781.1779112066.1567410322-794630202.1567146750

 

So, the first option - installation of Shopware on Ubuntu which is on Virtual Box failed

The second option was about Docker Container. The istruction is here https://docs.shopware.com/en/shopware-platform-dev-en/getting-started/installation-guide?_ga=2.211923924.1779112066.1567410322-794630202.1567146750#docker-installation-recommended

But it this is not full instruction and you sent me  https://docs.shopware.com/en/shopware-6-en/tutorials-and-faq/virtual-box-setup#download-the-vm  and this one is also very confusing. What is described here? I see the continuation of the first version which I did and failed. \

Is this another version of what I did? 

Does this VM include Docker inside? 

Does it already contain Shopware or I still have to clone and install it?

I installed it but no idea what Is installed. The IP address is 192.168.0.3 

In browser by this IP I get:

Unable to find a matching sales channel for the request: http://192.168.0.3/". Please make sure the domain mapping is correct

Next instruction is 

Now the Connection via SSH is possible via IPoftheVM and Port 22

What does that mean??

Could you please write all steps from 1 to the last one of how to install shopware with Docker Container?

 

OK After more efforts, I opened the admin panel in Broser by http://192.168.0.3/admin/ and I connected with my VSCode by SSH to the project folder on server /var/www/html/sw6

The bad news are that there is no frontend by  http://192.168.0.3/

It throws the error: Unable to find a matching sales channel for the request: http://192.168.0.3/". Please make sure the domain mapping is correct.

Also was not possible to map the network drive in Windows 

Vagrant and VirtualBox are not the same VMs. 

You need to evaluate what will be the best soltution for you. Without any changes the VM won’t get any IP in your local network and is only reachable on localhost. But you seems to have changed that - in t hat case, you need to do the things from the documentation: Shopware 6 - Setting Up a Local Environment with Virtual Box

Especially the part with the sales-channel configuration, otherwhise your sales channel won’t work any more (see your specific error message)

First call the admin via http://IPoftheVM/admin
Now it is necessary to adjust the URL for the sales channel „Storefront“ in the section „Domains“ to http://IPoftheVM
After you have saved the URL change, you can directly call the frontend via IPoftheVM

 

The VM from our documentation works out of the box, without any changes needed (only if you want an advanced configuration like NFS-Shares)

  1. Download it

  2. Import it to your virtual box

  3. run it in virtual box

  4. connect via SSH and execute „sw6“ to get the current master of development

  5. open 127.0.0.1:8080

Thank you very much! 

Yesterday was  cunfused with the word „IPoftheVM“ … Also, I was expecting to see the frontend by default, as usually is with most of applications. „Sales chanel“ is also something new for me… Today I managed to set the frontend url and it is now available.

So, you say that the VM out of box makes the wite available  on 127.0.0.1:8080? Probably it is available on this IP with the network adapter attached to NAT? In my case I switched it to Bridge Adapter following the instruction and the IP is 192.168.0.3 probably becuase of this change?

Regarding this VM, I would like to know more about it. All that I see is shopware.ova. What it includes inside? Has it a Docker container inside or Vagrant? Has it it’s Ubuntu included or it’s necessary firs to install ubuntu on VirtualBox? 

Do you have such VMs with different versions of Shopware, for example with SW 5.6? Or do you provide the recepy, how to easily create such VM with any version of SW including there all necessary components?

We (our agency) are going to build e-shops  based mostrly on Shopware, so I am looking for the best solution of dev. environment on local computer with windows.

 

The VM contains a linux environment (ubuntu) and a ready-to-use development installation of shopware. Its simply only a virtual box image that contains an operation system, a lamp stack and a script to set up a new shopware installation. You can use it for 5.6 too, but this will need some additional configuration.

When changing the NAT to Bridge, you need to adjust the sales channel in the admin of shopware (from 127.0.0.1 to the new ip in your local network) and it should work instantly. The setup contains a command „sw6“ that will set up a new installation from the current github master.

I installed the VM on another computer now leaving the VirtualBox network adapter to NAT. For some reasons, 127.0.0.1 doesn’t work. So, I switched again to Bridge and it’s OK.

I tried “sw6” command manually in order to reinstall the shopware and it failed at the end with the same errors as I had yesterday, when I installed Shopware on Ubuntu. 

So, in order to create a virtual machine with any version or any project inside I supoise is necessary manually create the machine, install the OS + Lamp Stack, download and deploy the project and at the end to export it from VirtualBox File -> Export Appliance…? It seems too much to do for each project. Probably there are some faster solutions, like to shoose and import a machine image with LAMP stack inside and then to install the project…

How can I install shopware 5.6 in the same way as shopware 6 (with VM image)?

 

The VM works out of the box - I don’t know why it is causing errors on your side. I’ve tested it once again and there is no error message during the installation.

Do you use putty or how do you connect via SSH?

 

 

There is no any problem with VM which I import in VirtualBox. The installation is ok just the 120.0.0.1 doesn’t work by default. With Bridge evrything is OK. 

The Errors I got when I tried to reinstall the shopware inside of this VM with „sw6“ command. Same errors I got yesterday when I created the VM and tried to install shopware.

I use ssh from WSL terminal (Windows subsistem for Linux). I never use Putty. I tried also sw6 command from VM bash and had the same errors. 

 

 

Regarding the Mapping the network drive I did not succeed to connect.

I use    \192.168.51.103\VM and for Username: ubuntu\shopware and Password: shopware

It just reloads the login window and does not connect.

Try port 4455 instead, perhaps there is still a port-mapping in your network configuration.

I’ve tried, didn’t help.

At the moment the best connection I have with VSCode + SSH FS plugin. It’s simple to set the connection and works directly on the server.

PHPstorm uses SFTP which downloads all project in a folder long time. But it has it’s advantage - Shopware plugin.