Error installing serialport on node.js

我只是一个虾纸丫 提交于 2019-12-11 13:13:32

问题


I am running windows 10 with node 4.2.2. I am trying to set up to work with my arduino but i keep running into issues installing serialport. Nothing I can find is helping. These are the errors I get when i run npm install serialport

npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "serialport" "-g"
npm ERR! node v4.2.2
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! serialport@2.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport@2.0.2 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR!     npm owner ls serialport
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\Users\john\Desktop\node-ardx\node_modules\johnny-five\npm-debug.log

回答1:


Make sure you have Python 2.7 installed. If you do, it may be an issue with the C++ compiler. Install Microsoft Build Tools 2015 (https://www.microsoft.com/en-us/download/details.aspx?id=48159) Then, on the cmd line change the default compiler to VS2015 :

$ npm config set msvs_version 2015

And to be extra sure :

$ set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140

If you now try to install serialport you'll get a couple of yellow warnings but installs without any issue.

Cheers!



来源:https://stackoverflow.com/questions/33579451/error-installing-serialport-on-node-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!