question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to run ndb globally

See original GitHub issue

I try every command in this topic https://github.com/GoogleChromeLabs/ndb/issues/20 but the error still happens

Cannot run the ndb command globally, It’s working fine in dev mode

Install global

~/myProjects/Node/cat mouse$ sudo npm install -g ndb --unsafe-perm=true --allow-root
/usr/bin/ndb -> /usr/lib/node_modules/ndb/ndb.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.0 (node_modules/ndb/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.0: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ ndb@1.1.5
updated 1 package in 5.838s

Run Global

~/myProjects/Node/cat mouse$ ndb mouse.js
Downloading Chromium r624492...
ERROR: Failed to download Chromium r624492!
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/ndb/node_modules/carlo/lib/.local-data'
  -- ASYNC --
    at BrowserFetcher.<anonymous> (/usr/lib/node_modules/ndb/node_modules/puppeteer-core/lib/helper.js:108:27)
    at downloadChromium (/usr/lib/node_modules/ndb/node_modules/carlo/lib/find_chrome.js:194:50)
    at findChrome (/usr/lib/node_modules/ndb/node_modules/carlo/lib/find_chrome.js:241:32)
    at Object.launch (/usr/lib/node_modules/ndb/node_modules/carlo/lib/carlo.js:594:42)
    at launch (/usr/lib/node_modules/ndb/lib/launcher.js:23:23)
    at Object.<anonymous> (/usr/lib/node_modules/ndb/ndb.js:35:1)
    at Module._compile (internal/modules/cjs/loader.js:945:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:962:10)
    at Module.load (internal/modules/cjs/loader.js:798:32)
    at Function.Module._load (internal/modules/cjs/loader.js:711:12) {
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/usr/lib/node_modules/ndb/node_modules/carlo/lib/.local-data'
}
unhandledRejection TypeError: Cannot read property 'executablePath' of null
    at findChrome (/usr/lib/node_modules/ndb/node_modules/carlo/lib/find_chrome.js:242:43)
    at async Object.launch (/usr/lib/node_modules/ndb/node_modules/carlo/lib/carlo.js:594:36)
    at async launch (/usr/lib/node_modules/ndb/lib/launcher.js:23:11)

Remove and try to reinstall again

~/myProjects/Node/cat mouse$ sudo npm uninstall -g ndb 
~/myProjects/Node/cat mouse$ removed 143 packages in 1.124s

~/myProjects/Node/cat mouse$ sudo npm install -g ndb --unsafe-perm=true --allow-root
/usr/bin/ndb -> /usr/lib/node_modules/ndb/ndb.js

> puppeteer-core@1.12.2 install /usr/lib/node_modules/ndb/node_modules/puppeteer-core
> node install.js


> node-pty@0.9.0-beta9 install /usr/lib/node_modules/ndb/node_modules/node-pty
> node scripts/install.js

make: Entering directory '/usr/lib/node_modules/ndb/node_modules/node-pty/build'
  CXX(target) Release/obj.target/pty/src/unix/pty.o
../src/unix/pty.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE PtyFork(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/unix/pty.cc:195:53: warning: ‘v8::Maybe<bool> v8::Value::BooleanValue(v8::Local<v8::Context>) const’ is deprecated: BooleanValue can never throw. Use Isolate version. [-Wdeprecated-declarations]
   if (info[8]->BooleanValue(Nan::GetCurrentContext()).FromJust()) {
                                                     ^
In file included from /home/bastian/.cache/node-gyp/12.11.1/include/node/v8-internal.h:14:0,
                 from /home/bastian/.cache/node-gyp/12.11.1/include/node/v8.h:25,
                 from /home/bastian/.cache/node-gyp/12.11.1/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/unix/pty.cc:20:
/home/bastian/.cache/node-gyp/12.11.1/include/node/v8.h:2606:51: note: declared here
                 V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(
                                                   ^
/home/bastian/.cache/node-gyp/12.11.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/unix/pty.cc: In function ‘void pty_after_waitpid(uv_async_t*)’:
../src/unix/pty.cc:495:69: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(v8::Local<v8::Object>, int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
   Nan::Callback(cb).Call(Nan::GetCurrentContext()->Global(), 2, argv);
                                                                     ^
In file included from ../src/unix/pty.cc:20:0:
../../nan/nan.h:1718:3: note: declared here
   Call(v8::Local<v8::Object> target
   ^~~~
  SOLINK_MODULE(target) Release/obj.target/pty.node
  COPY Release/pty.node
make: Leaving directory '/usr/lib/node_modules/ndb/node_modules/node-pty/build'

> node-pty@0.9.0-beta9 postinstall /usr/lib/node_modules/ndb/node_modules/node-pty
> node scripts/post-install.js

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.0 (node_modules/ndb/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.0: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ ndb@1.1.5
added 143 packages from 68 contributors in 8.737s

~/myProjects/Node/cat mouse$ ndb test.js
Downloading Chromium r624492...
ERROR: Failed to download Chromium r624492!
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/ndb/node_modules/carlo/lib/.local-data'
  -- ASYNC --
    at BrowserFetcher.<anonymous> (/usr/lib/node_modules/ndb/node_modules/puppeteer-core/lib/helper.js:108:27)
    at downloadChromium (/usr/lib/node_modules/ndb/node_modules/carlo/lib/find_chrome.js:194:50)
    at findChrome (/usr/lib/node_modules/ndb/node_modules/carlo/lib/find_chrome.js:241:32)
    at Object.launch (/usr/lib/node_modules/ndb/node_modules/carlo/lib/carlo.js:594:42)
    at launch (/usr/lib/node_modules/ndb/lib/launcher.js:23:23)
    at Object.<anonymous> (/usr/lib/node_modules/ndb/ndb.js:35:1)
    at Module._compile (internal/modules/cjs/loader.js:945:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:962:10)
    at Module.load (internal/modules/cjs/loader.js:798:32)
    at Function.Module._load (internal/modules/cjs/loader.js:711:12) {
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/usr/lib/node_modules/ndb/node_modules/carlo/lib/.local-data'
}
unhandledRejection TypeError: Cannot read property 'executablePath' of null
    at findChrome (/usr/lib/node_modules/ndb/node_modules/carlo/lib/find_chrome.js:242:43)
    at async Object.launch (/usr/lib/node_modules/ndb/node_modules/carlo/lib/carlo.js:594:36)
    at async launch (/usr/lib/node_modules/ndb/lib/launcher.js:23:11)

Try with sudo ndb test.js - still throwed error

sudo ndb test.js
Downloading Chromium r624492...
Chromium downloaded to /usr/lib/node_modules/ndb/node_modules/carlo/lib/.local-data/linux-624492
events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at Pipe.onStreamRead (internal/stream_base_commons.js:201:27)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: 'ECONNRESET',
  code: 'ECONNRESET',
  syscall: 'read'
}

One more time trying

~/myProjects/Node/catmouse$ ndb test.js
events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at Pipe.onStreamRead (internal/stream_base_commons.js:201:27)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: 'ECONNRESET',
  code: 'ECONNRESET',
  syscall: 'read'
}

Steps to reproduce

sudo npm install -g ndb --unsafe-perm=true --allow-root
ndb mouse.js
sudo ndb test.js

Tell us about your environment:

  • ndb version: v1.1.5
  • Platform / OS version: ubuntu 18.04
  • Node.js version: v12.11.1

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

5reactions
ChazAshleycommented, Jan 6, 2021

I fixed the issue for myself on Debian. Nothing worked but this. The issue happened to be in the downloaded Chromium. It simply wouldn’t start without --no-sandbox parameter. The Chromium is launched by ndb which itself uses puppeteer-core module.

To fix the issue:

  1. cd to /node_modules/puppeteer-core/lib
  2. Open Launcher.js
  3. Add --no-sandbox to the DEFAULT_ARGS array.
2reactions
ghazale-javahericommented, Mar 13, 2020

i use this answer ubuntu 18.04 and work https://stackoverflow.com/a/53717874/9781506

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Nodejs ndb installation ERROR: Failed to download ...
Try to install ndb with this command : PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 sudo npm install -g ndb --unsafe-perm=true --allow-root ftw · Then run ...
Read more >
21.5.4 ndb_mgmd — The NDB Cluster Management Server ...
Run ndb_mgmd in daemon mode (default) · Read given file after global files are read ; (Supported in all NDB releases based on...
Read more >
21.5.24 ndb_restore — Restore an NDB Cluster Backup
Before using ndb_restore, it is recommended that the cluster be running in ... such updates discovered by ndb_restore cause the restore operation to...
Read more >
Debugging JavaScript Performance With NDB
Use the Node debugger to visualise performance. ... Install ndb globally, initialise a new project and create a new file for the example:....
Read more >
ndb - npm
Chrome DevTools for Node.js. Latest version: 1.1.5, last published: 3 years ago. Start using ndb in your project by running `npm i ndb`....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found