Issue Summary
I develop in Visual Studio Code on Windows 10 to develop my Wordpress sites. I am using the NPM framework by Laravel as part of my workflow. By running the “npm run watch” script, the changes made in my code update automatically in the browser. It’s great.
I also use Local http://localwp.com (previously Local by Flywheel) version 5.7.5+4909 local development environment to install Wordpress and mysql databases and run them locally.
The problem I am having is that when I execute “npm run watch” from the command line in Visual Studio Code, the site opens at http://localhost:3000 and just hangs.
When the site is started and viewed in Localwp, it opens just fine, but at http://localhost:10005/
I need them to open on the same port! Is this possible to get these two in sync?
Troubleshooting Questions
-
Does this happen for all sites in Local, or just one in particular? Yes, it happens on all sites.
-
Are you able to create a new, plain WordPress site in Local and access it in a Browser? Yes, no problem.
System Details
-
Which version of Local is being used? – version 5.7.5+4909
-
What Operating System (OS) and OS version is being used? – Windows 10 Professional
-
Attach the Local Log. – not relevant
What I have done so far
I tried to change the port in the wp-config.php: from define( ‘DB_HOST’, ‘localhost:3000’ ); to define( ‘DB_HOST’, ‘localhost:3000’ );. But, when I tried to view the site in Localwp the site would not load, the same when I executed “npm run watch”.
According to posts can specify localhost port in Visual Studio Code
I edited launch.json (with is found here C:\Users\User.vscode\extensions\ms-vscode.atom-keybindings-3.0.8.vscode\launch.json)
Add the “env” variable to the file. It looked like this:
{
“version”: “0.2.0”,
“configurations”: [
{
“name”: “Launch Extension”,
“type”: “extensionHost”,
“request”: “launch”,
“runtimeExecutable”: “${execPath}”,
“args”: [
“–extensionDevelopmentPath=${workspaceRoot}”
],
“sourceMaps”: true,
“stopOnEntry”: false,
“env”: {
“ASPNETCORE_ENVIRONMENT”: “Development”,
“ASPNETCORE_URLS”: “http://localhost:10005/”
}
}
]
}
But this did absolutely nothing. “Npm run watch” kept on opening on port 3000.