set npm_config_target=1.2.3
set npm_config_arch=x64
set npm_config_target_arch=x64
set npm_config_disturl=https://atom.io/download/electron
set npm_config_runtime=electron
set npm_config_build_from_source=true
you can find version of npm_config_target in here.
Windows
I build the model by Visual Studio Build Tools. try this cmd and npm install node-serialport --save, dont forget to replace the path of VSBT and python
@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
set PYTHON=D:\Python27
set npm_config_target=3.0.2
set npm_config_arch=x64
set npm_config_target_arch=x64
set npm_config_disturl=https://atom.io/download/electron
set npm_config_runtime=electron
set npm_config_build_from_source=true
use electron-rebuild
install electron-rebuild to rebuild
npm install --save-dev electron-rebuild
# linux
./node_modules/.bin/electron-rebuild
windows
set the python path and VSBT in your cmd, then .\node_modules\.bin\electron-rebuild.cmd
If you want to use node-serialport on your electron app, u need rebuild it on electron. there are two way to rebuild the node-serialport.
make sure you have
node-gyp
&py2.7
.Visual Studio Build Tools Or VS, if your OS is Windows.
installation via npm
set some env variable, if your system is Linux
or Windows, use
set
instead ofexport
you can find version of
npm_config_target
in here.Windows
I build the model by Visual Studio Build Tools. try this cmd and
npm install node-serialport --save
, dont forget to replace the path of VSBT and pythonuse electron-rebuild
install
electron-rebuild
to rebuildwindows
set the python path and VSBT in your cmd, then
.\node_modules\.bin\electron-rebuild.cmd
the problem when you build
look at the log , mabye:
don't give up and try to fix