Error with electron : Exit status 3221225477


#1

Hi,

I’m beginner in Electron, I’m developping an application that allow to navigate on web. I have this error with some web sites

npm ERR! Windows_NT 6.1.7601
A Parser-blocking, cross-origin script, http://js.himediads.com/js?lang=fr&s=site.fr&z=homepage&d=2191861964, is invoked via document.write. This may be blocked by the browser if the device has poor network
connectivity. See https://www.chromestatus.com/feature/5718547946799104 for more details.
A Parser-blocking, cross-origin script, http://js.himediads.com/js?lang=fr&s=site.fr&z=homepage&d=2191861964, is invoked via document.write. This may be blocked by the browser if the device has poor network
connectivity. See https://www.chromestatus.com/feature/5718547946799104 for more details.
npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” "start"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! electrontest@1.0.0 start: electron .
npm ERR! Exit status 3221225477
npm ERR!
npm ERR! Failed at the electrontest@1.0.0 start script ‘electron .’.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the electrontest package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! electron .
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs electrontest
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls electrontest
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! D:\electron\change_protocol\npm-debug.log

Can you help me to fix this problem?

Thank you


#2

You are trying to directly load a slow insecure script into your app/window

The telling line is here:

cross-origin script, http://js.himediads.com/js?lang=fr&s=site.fr&z=homepage&d=2191861964, is invoked via document.write

You can have a look at the link it added: https://www.chromestatus.com/feature/5718547946799104


#3

Yes exactly (y)

but how can i fix it?

my code is here:

protocol.interceptHttpProtocol('https', (request, callback) => {

    var myURL = new URL(request.url);

    myURL.protocol = 'http';
    myURL.hostname = 'sousdomaine_.' + myURL.hostname;

    console.log("-- https to http modified : " + request.url + " => " + myURL.href);

    var redirectRequest = {
        url: myURL.href,
        method : request.method,
        referer: request.referrer,
        uploadData : request.uploadData
    };

    callback(redirectRequest);
})

session.defaultSession.webRequest.onBeforeSendHeaders({urls: ['<all_urls>']}, (details, callback) => {
    console.log(details)
    if(details.resourceType == "mainFrame")
            details.requestHeaders['X-Is-Page'] = '1';
    else
        details.requestHeaders['X-Is-Page'] = '0';

    callback({requestHeaders: details.requestHeaders})
})

some times this code displays errors (as descriped below) and some times, it correctly executes the code, BUT it does not display the website, in the devtool -> network, it displays “pending” to all images…


#4

It looks like you are intentionally rewriting all https:// request to be http:// which is why it is complaining about it being insecure. What happens if you load that url with https (assuming https is available for that site)?


#5

@dennisbaskin, thank you for your reply,

Yes exactly i’m redirecting https request to http requests.

I tried to load url with https -> The site is displayed correctly

I think that the problem is related to the use of interceptHttpProtocol


#6

Always this error message :

npm ERR! code ELIFECYCLE
npm ERR! errno 3221225477
npm ERR! electrontest@1.0.0 start: electron .
npm ERR! Exit status 3221225477
npm ERR!
npm ERR! Failed at the electrontest@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache_logs\2017-07-03T08_36_28_895Z-debug.log


#7

Check the log the message is referencing, it might have a bit more info on what is happening