stevenvachon / broken-link-checker

Find broken links, missing images, etc within your HTML.
MIT License
1.95k stars 302 forks source link

Unable to scan localhost #207

Closed ErickRenteria closed 3 years ago

ErickRenteria commented 3 years ago

Environment:

I'm not able to scan my localhost. Every time I run a scan it completes right away. If I point to a different site the scan runs but not local. Here is my code. Am I missing something here?

var { SiteChecker } = require("broken-link-checker");
var logCount = 0

const siteChecker = new SiteChecker(
    { 
        excludeInternalLinks: false,
        excludeExternalLinks: false, 
        filterLevel: 0,
        acceptedSchemes: ["http", "https"],
        excludedKeywords: ["other" ],

    },
    {
        "error": (error) => {
            console.error(error);

        },

        "link": (result, customData) => {
            if(result.broken) {
                if(result.http.response && ![undefined, 200].includes(result.http.response.statusCode)) {
                    console.log(`${result.http.response.statusCode} => ${result.url.original}`);
                }
            }

            console.log("Scanning link:" + logCount);
            logCount++;

        },

        "end": () => {
            console.log("COMPLETED!");
        }
    }
);

siteChecker.enqueue("http://localhost:8000/");
StefanTheWiz commented 3 years ago

worked fine for me using node v12.18.4 in docker

sators commented 3 years ago

Same problem here - duplicate of https://github.com/stevenvachon/broken-link-checker/issues/181