Synchronize ports: “NPM Watch” and Localwp are opening local site on two different ports rather than the same one

Question

I develop WordPress sites in Visual Studio Code on Windows 10. 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) for my 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 at http://localhost:10005/

I need them to open on the same port! Is this possible?

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 some posts in stackoverflow I can specify localhost port in Visual Studio Code
https://stackoverflow.com/questions/43358769/where-to-specify-localhost-port-in-vs-code/43360131

I edited launch.json (with is found here C:UsersUser.vscodeextensionsms-vscode.atom-keybindings-3.0.8.vscodelaunch.json)

Added 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.

Is it possible to get these two programs in sync!?!?

0
user51633 4 months 0 Answers 7 views 0

Leave an answer