Unhandled promise rejection error seen on startup

138 views
Skip to first unread message

K.R

unread,
Apr 8, 2018, 2:00:09 PM4/8/18
to TensorFlow.js Discussion
I get an error while starting and no webcam found error is seen on web page. How to resolve

webcam-transfer-learning$ yarn watch

yarn run v1.5.1

$ NODE_ENV=development parcel --no-hmr --open index.html 

Server running at http://localhost:1234 

  Building...

Unhandled promise rejection: Error: Exited with code 3

    at ChildProcess.cp.once.code (/home/kr/tfjs-examples/webcam-transfer-learning/node_modules/opn/index.js:84:13)

    at Object.onceWrapper (events.js:272:13)

    at ChildProcess.emit (events.js:180:13)

    at maybeClose (internal/child_process.js:936:16)

    at Socket.stream.socket.on (internal/child_process.js:353:11)

    at Socket.emit (events.js:180:13)

  Built in 1.82s.

Nikhil Thorat

unread,
Apr 8, 2018, 5:28:30 PM4/8/18
to K.R, TensorFlow.js Discussion
Have you run "yarn"?

--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+unsubscribe@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/f6d487bd-aef6-4293-9c16-e6407b4477ee%40tensorflow.org.

K.R

unread,
Apr 9, 2018, 12:23:32 AM4/9/18
to TensorFlow.js Discussion, reachkra...@gmail.com
Yes I ran "yarn"

This happens while running on a cloud VM instance (Ubuntu 16.04 or Linux 9 default), on a local machine it works fine (MacOS)

On Monday, April 9, 2018 at 2:58:30 AM UTC+5:30, Nikhil Thorat wrote:
Have you run "yarn"?
On Sun, Apr 8, 2018 at 2:00 PM, K.R <reachkra...@gmail.com> wrote:
I get an error while starting and no webcam found error is seen on web page. How to resolve

webcam-transfer-learning$ yarn watch

yarn run v1.5.1

$ NODE_ENV=development parcel --no-hmr --open index.html 

Server running at http://localhost:1234 

  Building...

Unhandled promise rejection: Error: Exited with code 3

    at ChildProcess.cp.once.code (/home/kr/tfjs-examples/webcam-transfer-learning/node_modules/opn/index.js:84:13)

    at Object.onceWrapper (events.js:272:13)

    at ChildProcess.emit (events.js:180:13)

    at maybeClose (internal/child_process.js:936:16)

    at Socket.stream.socket.on (internal/child_process.js:353:11)

    at Socket.emit (events.js:180:13)

  Built in 1.82s.

--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.

K.R

unread,
Apr 9, 2018, 9:57:35 AM4/9/18
to TensorFlow.js Discussion
The line which is failing is trying to run a command on the above line where it fails.
It seems to be looking for "xdg-open" while running on a VM (fails here), while it seems to be using "open" on the local machine.

yass...@google.com

unread,
Apr 9, 2018, 11:24:22 AM4/9/18
to TensorFlow.js Discussion

K.R

unread,
Apr 9, 2018, 2:29:16 PM4/9/18
to TensorFlow.js Discussion
I tried installing gvfs-bin but that doesn't seem to help.

K.R

unread,
Apr 9, 2018, 2:30:46 PM4/9/18
to TensorFlow.js Discussion

Additional information..


sudo apt install gvfs-bin

Reading package lists... Done

Building dependency tree       

Reading state information... Done

gvfs-bin is already the newest version (1.28.2-1ubuntu1~16.04.2).

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.



cat /etc/lsb-release 

DISTRIB_ID=Ubuntu

DISTRIB_RELEASE=16.04

DISTRIB_CODENAME=xenial

DISTRIB_DESCRIPTION="Ubuntu 16.04.4 LTS"

yass...@google.com

unread,
Apr 9, 2018, 3:27:16 PM4/9/18
to TensorFlow.js Discussion
Ah, one thing i can think of is whether the cloud vm is headless? Yarn watch is trying to start a dev server and open a browser window. Try running "yarn build" to see if the completes, it will produce a dist folder that you can serve from your cloud vm.

K.R

unread,
Apr 10, 2018, 2:30:43 PM4/10/18
to TensorFlow.js Discussion
yarn build output is getting generated properly. Can you provide a hint on how exactly you serve from a cloud vm without pushing into storage

yass...@google.com

unread,
Apr 10, 2018, 2:44:33 PM4/10/18
to TensorFlow.js Discussion
You could run a webserver to serve the contents of dist so that you can view it remotely. Since you have node js installed you could use https://www.npmjs.com/package/http-server as a simple static file server (but you can use any webserver that you are comfortable with). You should be able to point your browser to the index.html file (in dist) on the url/port that you set up from your cloud vm.

K.R

unread,
Apr 10, 2018, 10:44:47 PM4/10/18
to TensorFlow.js Discussion
You see the same error, "No webcam found" even when running from the dist folder.

yarn

yarn install v1.5.1

[1/5] Validating package.json...

[2/5] Resolving packages...

[3/5] Fetching packages...

info fsev...@1.1.3: The platform "linux" is incompatible with this module.

info "fsev...@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.

[4/5] Linking dependencies...

[5/5] Building fresh packages...

success Saved lockfile.

Done in 27.91s.



ls dist/

af7093ce3593435314f7cfd29a87abb7.svg  f1c90f053e7c94233683c9f3978b1aeb.css  index.html                                 tfjs-examples-webcam-transfer-learning.map

b6f2b1f5c311a9295ba17fe5ef4ce42c.png  ff9dad041ce782679a951207910043e4.svg  tfjs-examples-webcam-transfer-learning.js



tfjs-examples/webcam-transfer-learning/dist$ ../node_modules/http-server/bin/http-server 

Starting up http-server, serving ./

Available on:

  http://127.0.0.1:8080

  http://10.138.0.9:8080

Hit CTRL-C to stop the server

[Wed Apr 11 2018 02:38:53 GMT+0000 (UTC)] "GET /" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"

[Wed Apr 11 2018 02:38:53 GMT+0000 (UTC)] "GET /f1c90f053e7c94233683c9f3978b1aeb.css" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"

[Wed Apr 11 2018 02:38:53 GMT+0000 (UTC)] "GET /tfjs-examples-webcam-transfer-learning.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"

[Wed Apr 11 2018 02:38:53 GMT+0000 (UTC)] "GET /af7093ce3593435314f7cfd29a87abb7.svg" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"

[Wed Apr 11 2018 02:38:53 GMT+0000 (UTC)] "GET /b6f2b1f5c311a9295ba17fe5ef4ce42c.png" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"

[Wed Apr 11 2018 02:38:56 GMT+0000 (UTC)] "GET /favicon.ico" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"

[Wed Apr 11 2018 02:38:56 GMT+0000 (UTC)] "GET /favicon.ico" Error (404): "Not found"

[Wed Apr 11 2018 02:39:50 GMT+0000 (UTC)] "GET /index.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"

Yannick Assogba

unread,
Apr 11, 2018, 9:41:26 AM4/11/18
to K.R, TensorFlow.js Discussion
Do you get the same error when visiting https://storage.googleapis.com/tfjs-examples/webcam-transfer-learning/dist/index.html? Does the machine you are running this on have a webcam? 

K.R

unread,
Apr 11, 2018, 10:09:58 AM4/11/18
to TensorFlow.js Discussion, reachkra...@gmail.com
Yes it works fine from the storage location.

When I run via the http-server, I don't see any errors but I have a feeling that the following code is not getting initialized properly causing the webcam to be not initialized.

yass...@google.com

unread,
Apr 11, 2018, 10:27:30 AM4/11/18
to TensorFlow.js Discussion, reachkra...@gmail.com
Ah yes, to use the webcam in most browsers you need to serve the page over https (i.e. with an ssl/tls cert) when not using localhost.
Reply all
Reply to author
Forward
0 new messages