WordPress / playground-tools

GNU General Public License v2.0
127 stars 38 forks source link

Could not mount db.copy inside wp-config directory (Not a directory or a symbolic link to a directory.) #230

Closed ecotechie closed 2 weeks ago

ecotechie commented 2 months ago

Hi, I'm running Linux (NixOS) and am not able to run wp-now in the wp-content directory. I am able to run it just fine in a plugin or theme directory. I guess my goal was to run WordPress with several plugins and themes, so I could do some compatibility testing.

[sergio@nixie:/run/media/sergio/neon/var/www/nerdpress/wp-content]$ nix-shell -p nodePackages_latest.nodejs

[nix-shell:/run/media/sergio/neon/var/www/nerdpress/wp-content]$ npx @wp-now/wp-now start
Starting the server......
directory: /run/media/sergio/neon/var/www/nerdpress/wp-content
mode: wp-content
php: 8.0
wp: latest
Downloading WordPress latest...
Downloading SQLite...
Error: Could not mount /home/sergio/.wp-now/mu-plugins/sqlite-database-integration-main/db.copy: Not a directory or a symbolic link to a directory.
    at descriptor.value (/home/sergio/.npm/_npx/7c65af5c66ec2a7e/node_modules/@php-wasm/node/index.cjs:72642:17)
    at mountSqlitePlugin (file:///home/sergio/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-now/wp-now/main.js:830:9)
    at runWpContentMode (file:///home/sergio/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-now/wp-now/main.js:690:3)
    at async file:///home/sergio/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-now/wp-now/main.js:626:9
    at async applyToInstances (file:///home/sergio/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-now/wp-now/main.js:572:5)
    at async startWPNow (file:///home/sergio/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-now/wp-now/main.js:623:3)
    at async startServer (file:///home/sergio/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-now/wp-now/main.js:970:42)
    at async Object.handler (file:///home/sergio/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-now/wp-now/main.js:1152:25) {
  [cause]: [<generic error, no stack>] {
    name: 'ErrnoError',
    node: undefined,
    setErrno: [Function (anonymous)],
    errno: 54,
    message: 'FS error'
  }
}
Failed to start the server: Could not mount /home/sergio/.wp-now/mu-plugins/sqlite-database-integration-main/db.copy: Not a directory or a symbolic link to a directory.

Strangely, if I run npx @wp-now/wp-now start inside the WordPress root directory, all the themes and plugins are loaded. So I guess that is good enough for me.

What is the expected behavior of npx @wp-now/wp-now start in the wp-config directory?

bgrgicak commented 2 months ago

@ecotechie what version of wp-now are you using? This looks related to an issue we fixed recently https://github.com/WordPress/playground-tools/pull/169. If you are not using the latest version of wp-now, please update and restart your server.

adamziel commented 2 months ago

Transferring this issue to the playground-tools repo where wp-now lives.

ecotechie commented 2 months ago

@bgrgicak I think version 0.1.70?

[sergio@nixie:/run/media/sergio/neon/var/www/nerdpress]$ nix-shell -p nodePackages_latest.nodejs

[nix-shell:/run/media/sergio/neon/var/www/nerdpress]$ npx @wp-now/wp-now
Need to install the following packages:
@wp-now/wp-now@0.1.70
Ok to proceed? (y) 
wp-now <cmd> [args]

But when I run npx @wp-now/wp-now --version, I get unknown as output.

bgrgicak commented 2 months ago

I usually check the version using wp-now --versionm same result with npx @wp-now/wp-now --version.

bgrgicak commented 2 months ago

In the meantime, you can manually fix this by adding the plugin files into /home/sergio/.wp-now/mu-plugins/sqlite-database-integration-main/

ecotechie commented 2 months ago

Sorry, @bgrgicak not sure what you mean there. The link you shared is to a change log.

bgrgicak commented 2 months ago

Your local setup is missing the sqlite-database-integration plugin. To fix it you could download the latest version of the plugin (ZIP download) and copy the content of that zip into /home/sergio/.wp-now/mu-plugins/sqlite-database-integration-main/.

This will ensure that when wp-now loads, it will have the plugin available which includes the db.copy file that caused your error.

ecotechie commented 2 weeks ago

Back again... :sweat_smile: Not sure that's the issue. I've downloaded the latest version of the plugin and replaced it with the existing one. image

Still getting the same error: image

Also, having the same issue with VS Code and the WordPress Playground Extension...

Any ideas as to why this may be happening?

brandonpayton commented 2 weeks ago

Hi @ecotechie, I had a NixOS laptop sitting on my desk and was able to run wp-now within a wp-content directory. So... unfortunately, no effortless repro here. :-P

The error message is a bit odd:

Error: Could not mount /home/sergio/.wp-now/mu-plugins/sqlite-database-integration-main/db.copy: Not a directory or a symbolic link to a directory.

because db.copy is a file, not a directory.

Your latest error message screenshot shows that the line node_modules/@wp-now/wp-now/main.js:840:9 is involved in the error, and in my local copy of @wp-now/now, that points to this line: https://github.com/WordPress/playground-tools/blob/e7c9636fbfaa97b525d1a5debbfe68a867ca057b/packages/wp-now/src/wp-now.ts#L378-L381

But why would that lead to an error related to directory mounting?

Here are some questions :

ecotechie commented 2 weeks ago

Thanks @brandonpayton your link to the code solved my issue! It seems that the Query Monitor plugin creates a link to a db.php file in the wp-content directory, and that was causing some issues. I removed the file (link) and now it's working as it should.

lrwxrwxrwx 1 sergio users 69 Mar 18 11:23 db.php -> /var/www/nerdpress/wp-content/plugins/query-monitor/wp-content/db.php

Weird how the db.php file causes the error complaining about db.copy. Could this be a bug? I'm not as versed in JS as I'd like to be... :sweat_smile:

ecotechie commented 2 weeks ago

Looks like it may have been an older version of the Query Monitor plugin... I updated it and now it's all good. The db.wp is now a directory, by the way :shrug: