Pulling from Local is breaking Webpack

Issue Summary

I am working on a project using Local connected to WP Engine and a git repo on top. The first time I create the site in Local and pull the database down, and then add the git repo with git remote add origin it runs smoothly. However, any time I pull from Local after that it breaks Webpack and I get the following when trying to run npm start:

Error: Cannot find module ‘C:\Users\ryan\Local Sites\site-name\app\public\node_modules\webpack\bin\webpack.js’

Every time I do a pull in Local is seems to empty the webpack directory in node_moules.

Troubleshooting Questions

  • Does this happen for all sites in Local, or just one in particular?
    This is the first site I have worked on using Local.

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser?
    Yes.

System Details

  • Running Local 6.1.1+5468 on

  • Running on Windows 10 Pro (version 20H2)

Thanks for bringing this up!

Local should be leaving that node_modules folder intact during a pull since Local is supposed to be ignoring any node_modules folder:

What you’re describing though seems like that isn’t working which means there’s a bug somewhere.

When you pull the site down, are you using the MagicSync viewer to specifically select what files get changed? You can enable the MagicSync viewer from “Preferences > Appearance & Behavior”

I know that having to specifically select what files to move between environments can be tedious, but I want to zero in on the specific place that things are breaking.

Hey Ben, thanks for your reply

I just went into Local and enabled MagicSync and this is what it shows in the file list:

Welp, that looks like why Webpack is breaking after pulling – Local is deleting the entire node_modules folder!

I’ll create a bug report for our devs to work on a fix. In the meantime, can you try unchecking that top-level node_modules folder and then pull the site? This will basically tell Local to not delete all those files when pulling the site down.

Let me know if that workaround does what you need it to do!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.