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?
Thanks
请先登录再写评论。
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 runnpm installon Windows it returns and error. Putting it onoptionalDependenciescause npm to ignore the error and to continue with the installation of the other modules. Anyway it doesn't create the directory onoff innode_moduelsand 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
tscfor your app in terminal. Preceding the import with// @ts-ignoreis the only way to get rid of the error.