How do you 'npm install' in docker volume?

I’m trying to go through the Custom Gutenberg Block Development With the WordPress Block Editor course on Kinsta Academy.

In it, on the ’ Setting Up a Block Plugin With @wordpress/create-block’ section he talks about navigating to the site’s plugin directory and running npx @wordpress/create-block.

Mine is located here - \\wsl.localhost\docker-desktop-data\data\docker\volumes\DevKinsta\public\test-site\wp-content\plugins - so I open that in the terminal and try to run it, but get the following error:

`UNC paths are not supported. Defaulting to Windows directory.

Creating a new WordPress plugin in the my-first-block directory.
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^

[Error: EPERM: operation not permitted, mkdir ‘C:\Windows\my-first-block’] {
errno: -4048,
code: ‘EPERM’,
syscall: ‘mkdir’,
path: ‘C:\Windows\my-first-block’
}

Node.js v18.12.1`

I’ve been banging my head against the wall trying to figure out a way to get this to work, but haven’t had any luck. Anyone have any suggestions?

  • I have tried running the npx command elsewhere and manually moving the result over, which works, but I also need to be able to open the plugins directory in vs code for development & be able to run npm start in the directory.

Hi @ghughes13 :wave:

It looks like npx uses Command Prompt (cmd.exe) which does not have the proper permissions to create directories in C:\Windows, which is the default when you try to specify a UNC path.

Also, cmd.exe isn’t running as Administrator, so it will get a Operation not permitted error because it’s trying to mkdir (create a directory) in C:\Windows\ which requires Administrator user or group access.

Would you be able to try this solution, and let me know if it works?

Map your UNC path to a normal drive letter