I’m running into a recurring problem when working inside LocalWP site folders on my MacBook (Apple Silicon – M4 in my case).
Whenever I run npm install inside a Local site folder (e.g., /app/public/wp-content/themes/my-theme), it creates the node_modules folder but leaves it completely empty, no files, no errors.
This happens across different projects and with different Node/npm versions. If I run the exact same command outside Local’s mounted folders, everything installs normally.
It seems related to how Local mounts the site folders into its environment, possibly an issue with the filesystem sync layer on macOS Apple Silicon.
Have you or anyone else encountered similar issues? If so, do you already have a solution?
@mst We just released Local 9.2.6 yesterday with a change that may fix this for you if you’re using npm in Local’s site shell with mostly dev dependencies:
Site shells no longer inherit NODE_ENV=production from Local. npm commands you run in site shells now use the default NODE_ENV value (development). You can still override this in your shell config if needed.
Please could you try upgrading to Local 9.2.6 if you haven’t yet to see if that solves your issue?
I’ve updated to Local 9.2.6 and followed the steps you mentioned. I also renamed my old node_modules folder, deleted package-lock.json, and ran a fresh npm install but the issue still persists.
node_modules is created but only contains some empty folders. The actual module files are not being installed, which is very strange.
For context, I’m using Sage 10 as my WordPress theme. I’ve attached a screenshot showing the difference between two folders: one is node_modules installed from within Local (blank/partial), and the other is installed in another directory outside Local, then copied into the Local site folder to make it work.
Happy to test anything else that might help narrow down the cause.
Thanks for trying that, @mst. I wasn’t able to reproduce that with the Sage theme, I get folders and files on npm install (example below).
I found one other report of this in the past. It turned out to be specific to the user’s environment:
You could also try npm install --loglevel verbose to see if logs explain why files aren’t being created, or explore environment variables to check for differences in environments (e.g. run env on macOS/Linux, compare the output when it works and when it does not).
You originally suspected that it might be “related to how Local mounts the site folders into its environment, possibly an issue with the filesystem sync layer on macOS Apple Silicon.” But Local doesn’t mount any filesystems, it runs natively using your real filesystem, so the cause is likely elsewhere.