Tag Archives: electron

How to Solve error: command SH – C node install.js when installing electron

The following errors were reported during the recent installation of electron:

505 error code 1
506 error path /Users/**/04sendSms/node_modules/electron
507 error command failed
508 error command sh -c node install.js
509 error RequestError: read ETIMEDOUT
509 error     at ClientRequest.<anonymous> (/Users/**/04sendSms/node_modules/got/source/request-as-event-emitter.js:178:14)
509 error     at Object.onceWrapper (node:events:514:26)
509 error     at ClientRequest.emit (node:events:406:35)
509 error     at ClientRequest.origin.emit (/Users/**/04sendSms/node_modules/@szmarczak/http-timer/source/index.js:37:11)
509 error     at TLSSocket.socketErrorListener (node:_http_client:447:9)
509 error     at TLSSocket.emit (node:events:394:28)
509 error     at emitErrorNT (node:internal/streams/destroy:157:8)
509 error     at emitErrorCloseNT (node:internal/streams/destroy:122:3)
509 error     at processTicksAndRejections (node:internal/process/task_queues:83:21)
510 verbose exit 1

The solution to finding data is as follows:

Add a parameter to the installation--ignore-scripts

— ignore scripts means that NPM will not run the script’s script specified in package.json

npm install --save-dev electron --ignore-scripts

Uncaught type error: create-react-app and electronfs.existsSync is not a function

Add create react app to a project created by electron. Electronic cannot be used in react

When using require (‘Electronic ‘) in react, it will report
uncaught type error: fs.existssync is not a function at getelectronpath (index. JS: 8)
because the module of node.js cannot be used in react.
therefore, Baidu has proposed the following scheme:

Create the render.js file

global.electron = require('electron');

Modify the main.js file

Modify the entry code of creating browser and add preload configuration item. Render.js as preload file

win = new BrowserWindow({
        width: 1000,
        height: 800,
        webPreferences: {
            javascript: true,
            plugins: true,
            nodeIntegration: true, 
            webSecurity: false,
            preload: path.join(__dirname, '../public/renderer.js') 
        }
    })

in the react component, use electron

const electron = window.electron as follows

Because you want to use process communication, you can directly write this in the rendering process:

const ipcRenderer = window.electron.ipcRenderer;

At this time, there is no error in typeerror: fs.existssync is not a function
when fs.existssync is not a function error is no longer reported, a new error starts

Uncaught ReferenceError: require is not defined

I don’t know what’s going on. I’m just looking at my main.js. The node environment shouldn’t report an error that doesn’t have the definition of require. So Baidu has made a lot of changes, so I modified several of my files:
index.html:

<script>
    window.electron = require('electron');
  </script>
  <div id="root"></div>

main.js:

win = new BrowserWindow({
        width: 1000,
        height: 800,
        webPreferences: {
            nodeIntegration: true, 
        }
    })

In the rendering process that references this:

getName = (e) =>{
        e.preventDefault()
        const ipcRenderer = window.electron.ipcRenderer;
        // console.log(ipcRenderer.sendSync('synchronous-message', 'ping')) // prints "pong"

        // ipcRenderer.on('asynchronous-reply', (event, arg) => {
        //     console.log(arg) // prints "pong"
        // })
        ipcRenderer.send('asynchronous-message', 'ping')
        // ipcRenderer.send('get-reader-list', '')
    }

And then you can

npm run electron

It’s working perfectly

Happy ~ ~ ~ thank you for helping me@ The way of heaven rewards diligence,
although small water drops are insignificant, they can gather little by little into the sea! Take your time. Sometimes when you feel it’s hard to walk, you’re going uphill. Come on
later, a new project was created, and it was found that both methods were feasible and could be tried many times

Windows 95 written in JavaScript can run on multiple platforms

Windows 95 written in JavaScript can run on multiple platforms

According to cnBeta, slack developer Felix rieseberg released Windows 95 as an electron application two years ago, which is written entirely in JavaScript. In the subsequent continuous update, it can run classic games such as “destroyer”. Now he’s rolling out a new version of Windows 95 electron that will run on windows, Mac OS and Linux.

Hard core Lao Wang comments: the omnipotent JavaScript actually reproduced the classic operating system of that year.

libresl is difficult to replace OpenSSL

According to solidot, the industry has been shaken by flaws in SSL infrastructure software. This led the CII and Linux foundation to fund the development of key components. The OpenBSD project created libresl, the branch of OpenSSL. This branch has been used and actively developed by OpenBSD distribution since then. However, the Linux world doesn’t buy it. OpenSSL is supported to a greater extent, which makes the OpenSSL project solve many of its long-term problems and make it more secure and stable.

As a result, very few Linux distributions migrate to libresl. Alpine and Gentoo distributions are trying to provide libresl, and alpine will soon return to OpenSSL; Gentoo’s support for libresl will end in February this year. Gentoo developers point out that libresl does not offer much benefit compared with OpenSSL, but increases the cost.

Hard core Lao Wang commented: this result is staggering. The incomplete and old software can actually be reborn, surpassing the new successors. It can be seen how much software inertia is.

US regulators consider allowing federal chartered banks to issue and promote stable currency

According to cnBeta, the office of the Comptroller of currency said in an explanatory letter that federal chartered banks and savings associations could consider using public blockchain and stable currency to carry out settlement business. This means that as long as existing laws are followed, banks can choose to use the public blockchain for verification, storage, recording and settlement. Or run your own encryption node and use the associated stable currency for licensed payment activities.

Hard core Lao Wang comments: it seems that the U.S. banking industry can not sit still.