Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

ndb wont start #13

Closed
abalmos opened this issue Jul 21, 2018 · 11 comments
Closed

ndb wont start #13

abalmos opened this issue Jul 21, 2018 · 11 comments

Comments

@abalmos
Copy link

abalmos commented Jul 21, 2018

Steps to reproduce

$ npm i -g ndb

... snip ...
+ ndb@1.0.3
added 182 packages from 110 contributors in 22.355s

$ ndb

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at Pipe.onread (net.js:660:25)
Emitted 'error' event at:
    at emitErrorNT (intenal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Tell us about your environment:

  • ndb version: 1.0.3 (tried 10.0, 1.0.1, and 1.0.2)
  • Platform / OS version: Debian 9 testing
  • Node.js version: 10.7 (tried 10.6 and 10.4.1)

What is the expected result?

ndb to start

What happens instead?

ECONNRESET error

Thanks for this project. Looking forward to try it out!

@b0o
Copy link

b0o commented Jul 21, 2018

Same exact issue here on Arch Linux (Linux 4.17.8-1-ARCH x86_64 GNU/Linux).

I tried Node 10.0.7 and 9.11.2 as well as ndb 1.0.0, 1.0.1, 1.0.2, and 1.0.3.

@alexkozy
Copy link
Contributor

Ndb uses puppeteer. Most likely this issue is related to pptr issue: puppeteer/puppeteer#290. Could you please try to install all required dependencies and try to launch ndb again?

@b0o
Copy link

b0o commented Jul 21, 2018

@ak239 I checked the troubleshooting link you provided and figured out that this seems to be a sandboxing issue with Puppeteer.

Details Modifying the Puppeteer launch arguments here:

ndb/ndb.js

Lines 35 to 38 in 97d893c

args: [
'--app=data:text/html,<style>html{background:#242424;}</style>',
'--enable-features=NetworkService'
]

To include --no-sandbox fixed the issue for me:

diff --git a/ndb.js b/ndb.js
index 13fa599..6947312 100755
--- a/ndb.js
+++ b/ndb.js
@@ -34,7 +34,8 @@ updateNotifier({pkg: require('./package.json')}).notify();
     userDataDir: await setupUserDataDir(configDir),
     args: [
       '--app=data:text/html,<style>html{background:#242424;}</style>',
-      '--enable-features=NetworkService'
+      '--enable-features=NetworkService',
+      '--no-sandbox',
     ]
   });

Enabling kernel.unprivileged_userns_clone fixed this for me (via puppeteer/puppeteer#290 (comment)):

sudo sysctl -w kernel.unprivileged_userns_clone=1

@alexkozy
Copy link
Contributor

Thanks a lot! I created PR that added --no-sandbox flag by default. Sandboxing is not as useful as it is inside Chromium in our environment so we can switch it off for now.

alexkozy added a commit that referenced this issue Jul 21, 2018
This flag may produce error at start on some Linux distributions.
At the same time we control what code is executed in browser and
expose some capabilities like way to run node process so
sandboxing is not as usefull as it is inside Chrome.

Fixes #13
@alexkozy
Copy link
Contributor

fix is available in 1.0.4 and already published to npm 😄

@abalmos
Copy link
Author

abalmos commented Jul 21, 2018

@ak239 thanks, it is working now

@FedericoBiccheddu
Copy link

Having the same issue in a docker environment.

node: 10.7.0
ndb: 1.0.6
puppeteer: 1.6.0 (installed as a devDependency too)

This is the output:

ndb nodemon -L -r ts-node/register 'src/index.ts'
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at WriteWrap.afterWrite [as oncomplete] (net.js:836:14)
Emitted 'error' event at:
    at onwriteError (_stream_writable.js:431:12)
    at onwrite (_stream_writable.js:456:5)
    at _destroy (internal/streams/destroy.js:40:7)
    at Socket._destroy (net.js:606:3)
    at Socket.destroy (internal/streams/destroy.js:32:8)
    at WriteWrap.afterWrite [as oncomplete] (net.js:838:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Is there any possibile solution?

Thank you 😄

@colbin8r
Copy link

colbin8r commented Aug 7, 2018

Having the same issue as @FedericoBiccheddu with
Node 10.8.0
npm 6.2.0
ndb 1.0.19

@alexkozy
Copy link
Contributor

alexkozy commented Aug 7, 2018

Could you try to install all dependencies mentioned in puppeteer thread?

RUN apt-get update && \
apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget```

@alexkozy alexkozy reopened this Aug 7, 2018
@gerbus
Copy link

gerbus commented Nov 1, 2018

Having the same issue as @FedericoBiccheddu with
Node 10.10.0
npm 6.4.1
ndb 1.0.26
Ubuntu 14.04

@gerbus
Copy link

gerbus commented Nov 1, 2018

After installing the above suggested dependencies, I get:

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at Pipe.onStreamRead (internal/stream_base_commons.js:111:27)
Emitted 'error' event at:
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

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

6 participants