szwacz/electron-boilerplate

npm ERR! Failed at the electron-boilerplate@0.0.0 install script 'electron-rebuild'.

yilunyu opened this issue · 1 comments

I am using the boilerplate as a place to start off my first electron project. I am using a Windows 7. running npm install on the original electron-boilerplate is completely fine. I made some changes to the boilerplate project so that it could communicate with the serial port. I added serialport and vendor to package.json so that it looks like:

"dependencies": {
"fs-jetpack": "^0.10.2",
"serialport": "^4.0.7"
}
"build": {
"appId": "com.example.electron-boilerplate",
"files": [
"app//*",
"node_modules/
/*",
"package.json",
"vendor"
]
}

Doing this initially gave me
gyp ERR! configure error
gyp ERR! stack error: can't find Python executable "python" ...

I installed the newest python 2 and the first problem went away. Now it is giving me this error:

An unhandled error occurred inside electron-rebuild
C:\Users\yu\projects\electron-boilerplate2\cesller-phone\node_modules\serialport
\build\binding.sln : error MSB3411: Could not load the Visual C++ component "VCB
uild.exe". If the component is not installed, either 1) install the Microsoft Wi
ndows SDK for Windows Server 2008 and .NET Framework 3.5, or 2) install Microsof
t Visual Studio 2008.
...

I do not wish to install these. Why did this problem not occur on the original boilerplate project when electron-rebuild is listed as a devDependency? Is there a way to bypass electron-rebuild or solve this without installing all of those things recommended? I tried just running npm install --production, since electron-rebuild is only a devDependency, but it gave me the same error.

electron-rebuild is the thing you need to rebuild native module for electron (when you did npm install it was built for your locally installed node.js). So the problem is that serialportgives trouble when rebuilding. I seen people in the past having trouble with this library and, there is whole topic about it: serialport/node-serialport#538

So probably you'll need to do some googling and hacking to have serialport installed.