WordPress Sage: gulp watch opens wrong URL

Whether I start from a copy of an existing Sage theme folder (successfully installed in the past) or from a new install generated through Composer, after running npm install, gulp watch yields this error: Error: Bower components directory does not exist at D:\EasyPHP\www\laughable\wp-content\themes\laughable\bower_components

If I do bower install and run gulp watch again, the site does open in a new tab automatically but the URL is wrong: instead of being like http://localhost:3000/my_site it’s just http://localhost:3000/ (so I get a blank screen instead of my site.

What’s going on? Why it doesn’t work?

Have you checked the devUrl in assets/manifest.json?

That file should not be touched by installing bower or npm, but can sometimes cause the problem you’re describing.

1 Like

Make sure you have your node_modules and bower_components directories present in your theme’s root. If not, make sure to run npm install and bower install.

As @Gerben mentioned, make sure the "devUrl": "http://example.dev" is set to your correct dev URL within assets/manifest.json. The new tab that opens should just show http://localhost:3000.

You’re right guys “devUrl” wasn’t set to the right value in “manifest.json”, thanks!