Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在node.js上安装serialport时出错_Node.js_Node Serialport - Fatal编程技术网

在node.js上安装serialport时出错

在node.js上安装serialport时出错,node.js,node-serialport,Node.js,Node Serialport,我正在运行节点为4.2.2的windows 10。我正在尝试设置与我的arduino一起工作,但我在安装serialport时不断遇到问题。我找不到任何有用的东西。这些是我在运行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\\bi

我正在运行节点为4.2.2的windows 10。我正在尝试设置与我的arduino一起工作,但我在安装serialport时不断遇到问题。我找不到任何有用的东西。这些是我在运行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

确保已安装Python2.7。如果你这样做,这可能是C++编译器的问题。 安装Microsoft Build Tools 2015() 然后,在cmd行上,将默认编译器更改为VS2015:

$ npm config set msvs_version 2015
更确切地说:

$ set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140
如果您现在尝试安装serialport,您将收到几个黄色警告,但安装时不会出现任何问题


干杯

你安装了Python和C++编译器吗?谢谢大家。就像你说的那样,它最终成为编译器的一个问题。我重新安装并配置了它,它工作了…:-)