wordup-dev / wordup-cli

Wordup is a fully integrated development platform for WordPress. Develop plugins and themes locally. Preview in the cloud. Automatic updates in WP.
GNU General Public License v3.0
118 stars 16 forks source link

wordup init fails on centos 7 (npm WARN lifecycle) #26

Open simonmeggle opened 4 years ago

simonmeggle commented 4 years ago

I just tried wordup on a centos7 machine and failed to install the server. There is a weird WARN message I cannot interpret:

wordup init 
...
...
? Search public WordPress plugins (leave blank if you dont want to add plugins)
? Search public WordPress themes (leave blank if you dont want to add themes)
   create README.md
   create .gitignore
   create .wordup/config.yml
   create package.json
npm WARN lifecycle foobar@0.1.0~postinstall: cannot run in wd test@0.1.0 wordup install || true (wd=/root/foobar)
npm notice created a lockfile as package-lock.json. You should commit this file.
up to date in 0.392s
found 0 vulnerabilities

---

Successfully init new wordup project (/root/test)
Just open your project folder and start developing :-)

wordup install was executed automatically as a postinstall script in your package.json

=> Something got broken/not finished during the initialisation.

Starting the instance then fails with:

wordup install
Installing wordup project and connected docker containers (can take some minutes)... ✔
Waiting for the containers to boot... ✔
Setting-up WordPress based on your .wordup/config.yml... -
 ›   Error: There was an error with setting-up WordPress

The logs of the wordup-cli container contain the line

[29-Mar-2020 14:33:41 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22
[29-Mar-2020 14:33:41 UTC] PHP Stack trace:    
[29-Mar-2020 14:33:41 UTC] PHP   1. {main}() Standard input code:0
[29-Mar-2020 14:33:41 UTC] PHP   2. mysqli->__construct() Standard input code:22
2020-03-29T14:33:41.037493588Z
MySQL Connection Error: (2002) Connection refused

node.js version: v13.12.0 Docker version 18.06.3-ce, build d7080c1

But I can start wordup projects I have created on my mac.

Thanks for any assistance... BR Simon

shry commented 4 years ago

I guess you are trying to run wordup on a VM? The mysql error shows me that probably the mariadb container is not starting as expected. I had this issue also on different VMs. In the next big release i will switch to bitnami containers, i hope that this issue will be gone after that.

simonmeggle commented 4 years ago

No, I am working on a physical machine which has even much more power than my mac :-) Yes, the error sounds that the mariadb is not reachable. But I exec'd into the wordpress container, installed a db client and could connect. I also thought that the wp container tries to connect to the db too early and edited the docker-compose file. With the help of the dadarek/wait-for-dependencies image, I was able to delay the start of the wp container until db is really reachable on port 3306:

  wordpress:
    depends_on:
      - start_dependencies
    ...
    ...
  wordpress-cli:
    depends_on:
      - start_dependencies
    ...
    ...
  start_dependencies:
    image: dadarek/wait-for-dependencies
    depends_on:
      - db
    command: db:3306

But even in this way, it did not work.

Can you imagine a reason for the line

npm WARN lifecycle foobar@0.1.0~postinstall: cannot run in wd test@0.1.0 wordup install || true (wd=/root/foobar)

during the "install" command? This is only happening on the linux machine, not on the mac. I think that this is the root cause. But I have no experience with node/npm and cannot interpret this error. Any try with unsafe-perm = true in rc files (found by googling) was unsuccessful.

Thanks, Simon

shry commented 4 years ago

It could be a permission issue, have you tried to run with sudo?

simonmeggle commented 4 years ago

Yes, the error also comes when executing as root.