Can't get rid of Unresolved type SerialPort warning


I'm using Webstorm 8.0.4 to modify a node.js program which is requiring a package (node-rfxcom) which uses the serialport package. The program runs correctly. In the IDE, I'm getting a warning 'Unresolved type SerialPort' at the line where a serial port is created.

var serialport = require("serialport");

<lines left out>

    if (typeof self.serialport === "undefined") {
        self.serialport = new serialport.SerialPort(self.device, {
            baudrate: 38400,
            parser: self.rfxtrxParser()

I repeat that everything works and the serial port is being created properly. How do I get rid of this warning? I've added node-rfxcom/node_modules (as a directory), node-rfxcom/node_modules/serialport (as a directory), and node-rfxcom/node_modules/serialport/serialport.js (as a file) to a library of framework type node_modules in the JavaScript>Libraries dialog, indiviually and in combination; with project and with global visibility, but all to no effect.

I've only just started using WebStorm so I still have a lot to learn. I've been ignoring this problem as just one more (unnecessary?) thing to worry about so far but I really ought to learn how to drive this IDE properly!

Comment actions Permalink

The bug has been logged as, please vote for it to be notified on any progress

Comment actions Permalink

As a workaround you can disable "Unresolved JavaScript function" inspection or suppress it for the statement:
* Position text cursor on "SerialPort" word
* Press Alt+Enter
* Expand "Create method 'SerialPort'" and choose "Disable inspection" or "Suppress for statement"

Comment actions Permalink

So it is a bug & not just me!

Assuming it worked as intended, would I just add the appropriate node_modules directory (as a directory) to the list of libraries and expect Webstorm to rescurse down into it? Assuming it was added as a library of type 'node_modules'?


Comment actions Permalink

You shoudn't have done anything if it worked as intended - node_modules folder exists in the project and is even added to libraries, it's enough for WebStorm to recurse down into it.
See to get an idea of javascript libraries in WebStorm


Please sign in to leave a comment.