Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

electron - The line const Ctl = require('ipfsd-ctl'); causes : "Your browser does not have secure random generator

In an Electron app when I activate this line:

const Ctl = require('ipfsd-ctl');

I get the following error message:

A JavaScript error occurred in the main process
Uncaught Exception:
Error: Your browser does not have secure random generator. If you don’t need unpredictable IDs, you  
can use nanoid/non-secure.
    at Module../node_modules/nanoid/index.browser.js (/home/marco/webMatters/electronMatters
/IPFSbase/.webpack/main/index.js:35804:11)
    at __webpack_require__ (/home/marco/webMatters/electronMatters/IPFSbase/.webpack
/main/index.js:21:30)
    at Object../node_modules/ipfsd-ctl/src/utils.browser.js (/home/marco/webMatters
/electronMatters/IPFSbase/.webpack/main/index.js:23961:20)
    at __webpack_require__ (/home/marco/webMatters/electronMatters/IPFSbase/.webpack
/main/index.js:21:30)
    at Object../node_modules/ipfsd-ctl/src/factory.js (/home/marco/webMatters/electronMatters
/IPFSbase/.webpack/main/index.js:23232:20)
    at __webpack_require__ (/home/marco/webMatters/electronMatters/IPFSbase/.webpack
/main/index.js:21:30)
    at Object../node_modules/ipfsd-ctl/src/index.js (/home/marco/webMatters/electronMatters
/IPFSbase/.webpack/main/index.js:23407:17)
    at __webpack_require__ (/home/marco/webMatters/electronMatters/IPFSbase/.webpack
/main/index.js:21:30)
    at Object../src/daemon/daemon.js (/home/marco/webMatters/electronMatters/IPFSbase
/.webpack/main/index.js:49144:13)
    at __webpack_require__ (/home/marco/webMatters/electronMatters/IPFSbase/.webpack
/main/index.js:21:30)

in package.json :

devDependencies:
    "electron": "^10.1.2",
    "ipfs-or-gateway": "^2.1.0",

dependencies:
    "ipfs": "^0.53.1",
    "ipfs-http-client": "^48.2.0",
    "ipfsd-ctl": "^7.2.0",
    "is-ipfs": "^2.0.0",
  • OS: Ubuntu 18.04.4 Desktop
  • node version: v14.5.0

How to solve the problem?

question from:https://stackoverflow.com/questions/65850858/the-line-const-ctl-requireipfsd-ctl-causes-your-browser-does-not-have

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...