Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

"assert is not defined" in Electron #852

Closed
negamaxi opened this issue May 13, 2017 · 6 comments
Closed

"assert is not defined" in Electron #852

negamaxi opened this issue May 13, 2017 · 6 comments

Comments

@negamaxi
Copy link
Contributor

Simple webpack bundle with this two lines:

import IPFS from 'ipfs'
const ipfs = new IPFS()

...throws this in Electron app.
error1
Same code works well in Chrome tab. First I assumed something wrong with webpack bundle, but cdn bundle of ipfs-iiif-db embeded with <script> tag also refuses to work in Electron.

webpack 2.3.3 + webpack dev server 2.4.2 + electron 1.6.2 + ipfs 0.23.1

@negamaxi
Copy link
Contributor Author

<script src="https://unpkg.com/ipfs/dist/index.js"></script>
const ipfs = Ipfs()

throws this error, again, only in Electron window

Uncaught TypeError: createServer is not a function
    at module.exports (listener.js:9)
    at WebSockets.createListener (index.js:43)
    at transport.js:86
    at parallel.js:27
    at eachOfArrayLike (eachOf.js:61)
    at exports.default (eachOf.js:9)
    at _parallel (parallel.js:26)
    at parallelLimit (parallel.js:87)
    at Object.listen (transport.js:106)
    at each (index.js:90)

@daviddias
Copy link
Member

@negamaxi it is important to understand which process of electron you are using, is it the Node.js process or the Browser process?

@negamaxi
Copy link
Contributor Author

@diasdavid ipfs code served by webpack on 'http://localhost:8080'. Electron opens this address in a new window. That means browser process, I guess.

mainWindow = new BrowserWindow({width: 800, height: 600})
const URL = 'http://localhost:8080'
mainWindow.loadURL(URL)

Same page opened in Chrome in parallel works just fine.

@negamaxi
Copy link
Contributor Author

Reproduced on pure electron-quickstart-app here https://github.com/negamaxi/electron-ipfs-quick-start . IPFS added with script tag and initialized in renderer.js. Throws createServer error already mentioned above. When added via npm throws something new:

Uncaught Error: Cannot find module '/mnt/sda5/Projects/electron-ipfs-quick-start/node_modules/wrtc/build/wrtc/v0.0.61/Release/electron-v1.6-linux-x64/wrtc.node'
    at Module._resolveFilename (module.js:470)
    at Function.Module._resolveFilename (/mnt/sda5/Projects/electron-ipfs-quick-start/node_modules/electron/dist/resources/electron.asar/com…:35)
    at Function.Module._load (module.js:418)
    at Module.require (module.js:498)
    at require (internal/module.js:20)
    at Object.<anonymous> (/mnt/sda5/Projects/electron-ipfs-quick-start/node_modules/wrtc/lib/peerconnection.js:6)
    at Object.<anonymous> (/mnt/sda5/Projects/electron-ipfs-quick-start/node_modules/wrtc/lib/peerconnection.js:419)
    at Module._compile (module.js:571)
    at Object.Module._extensions..js (module.js:580)
    at Module.load (module.js:488)

It maybe somehow connected with this errors occured during installation.

node-pre-gyp ERR! Tried to download(404): https://node-webrtc.s3.amazonaws.com/wrtc/v0.0.61/Release/node-v51-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for wrtc@0.0.61 and node@7.10.0 (node-v51 ABI) (falling back to source compile with node-gyp)
`

@daviddias
Copy link
Member

Hi! I started working on electron support, track it in #843

@daviddias
Copy link
Member

Let's convert our focus on #843

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants