read data from serial port using angular2

2,337 views
Skip to first unread message

Jitendra Rajauriya

unread,
Aug 14, 2019, 3:56:47 AM8/14/19
to Angular and AngularJS discussion
We want to serial port communication using existing angular2 project.

I installed the following.

npm install serialport --save
npm install
@types/serialport --save

and

import { SerialPort } from 'serialport' in component.ts
serialPort
: typeof SerialPort;

now we got undefined from serialPort.
and got the
Can't resolve 'child_process' node_modules\@serialport\bindings\lib error for get port.
any one can help.


Sander Elias

unread,
Aug 14, 2019, 4:22:51 AM8/14/19
to Angular and AngularJS discussion
Hi Jitendra,

Is the serialPort module suited for use in a browser? A lot of NPM modules only work in a server setting!

Regards
Sander

Jitendra Rajauriya

unread,
Aug 14, 2019, 5:20:06 AM8/14/19
to ang...@googlegroups.com
thanks for reply i want to client side serial communication with existing angular project.
can you give me better solutions.

Thanks

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/768646a7-f0bb-48db-b22f-1219140df2b1%40googlegroups.com.

Sander Elias

unread,
Aug 14, 2019, 6:54:06 AM8/14/19
to Angular and AngularJS discussion

Jitendra Rajauriya

unread,
Aug 16, 2019, 9:01:56 AM8/16/19
to ang...@googlegroups.com
we are using https://github.com/garrows/browser-serialport for serial communication in client side.
when we using following after import in angular component
SerialPort.list(function(err, ports) {
            console.log(err);
            console.log(ports);
        });

we got Error: No access to serial ports. Try loading as a Chrome Application.
any suggestions?


On Wed, Aug 14, 2019 at 4:31 PM Sander Elias <sande...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.

Sander Elias

unread,
Aug 18, 2019, 12:03:48 AM8/18/19
to Angular and AngularJS discussion
Yes, that is a constraint Google did put in Chrome. Clearly documented in that repo.
There is also web-serial in the pipeline. That will be available in Chrome 77 behind a flag.  It's expected to go main-stream in V80/83, (expectation, not a guarantee!)

 

Regards
Sander

Abhishek khatri

unread,
Dec 7, 2022, 1:56:05 AM12/7/22
to Angular and AngularJS discussion
Hi anyone can tell me how I can read a port number using typescript in angular 
I tried lots of logic of it but nothing is happen can anyone here who tell me the right way to get the serial port number 


Thanks in Advance
Reply all
Reply to author
Forward
0 new messages