2015-11-07 139 views
1

我正在運行帶有節點4.2.2的windows 10。我試圖設置與我的arduino一起工作,但我一直遇到安裝serialport的問題。沒有我能找到的是幫助。這些是我運行npm時出現的錯誤安裝串口在node.js上安裝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! [email protected] install: `node-pre-gyp install --fallback-to-build` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] 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 
+0

你是否已經安裝了['node-gyp''s dependencies](https://github.com/nodejs/node-gyp#installation) - Python和C++編譯器? –

回答

0

請確保您安裝了Python 2.7。如果這樣做,這可能是C++編譯器的問題。 安裝Microsoft構建工具2015(https://www.microsoft.com/en-us/download/details.aspx?id=48159) 然後,在CMD線更改默認的編譯器VS2015:

$ npm config set msvs_version 2015 

而且要加倍肯定的:

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

如果現在嘗試安裝的SerialPort你會得到一些黃色的警告,但安裝沒有任何問題。

乾杯!

+0

謝謝你們。它最終成爲像你說的雨果那樣的編譯器問題。我重新安裝並重新配置它,它工作... :-) –