nodejs cross compilation

Hi all,

I'm working on a nodejs service with WebStorm. I develop on Windows but the service is intended to work on Linux/Raspberry PI,  so I set Webstorm to sync the sources on save with a linux server via ssh/scp and setup a gulp process to recompile and run the service on it.

Everything is working quite well except for one problem. My service uses a couple of modules that work only on Linux. So I put them in  the optionalDependencies section on package.json so that, on Windows, error in compiling them doesn't stops the building of the rest of the project.

The problem is that, the directories for those modules, on Windows, are not created and Webstorm complains about the missing.

Is there any solution for that?



Please could you clarify what errors are meant? Some screenshots that show what it looks like on your end would be helpful.


The module onoff, works only on Linux and If I try to run npm install on Windows it returns and error. Putting it on optionalDependencies cause npm to ignore the error and to continue with the installation of the other modules. Anyway it doesn't create the directory onoff in node_moduels and Webstorm complaint about it.

The installation and execution on Linux works flawless.


I see, thanks for update.

The error comes from the Typescript language service. I believe that you will face the same issue when running tsc for your app in terminal. Preceding the import with // @ts-ignore is the only way to get rid of the error.