Node.js – 在Windows上安装johnny五库

我试图在Windows 7上安装Node.js的johnny五库,但不断收到错误:

Your environment has been set up for using Node.js 0.10.15 (x64) and npm. C:\Users\User>npm install johnny-five npm http GET https://registry.npmjs.org/johnny-five npm http 304 https://registry.npmjs.org/johnny-five npm http GET https://registry.npmjs.org/colors npm http GET https://registry.npmjs.org/firmata npm http GET https://registry.npmjs.org/es6-collections npm http GET https://registry.npmjs.org/descriptor npm http GET https://registry.npmjs.org/lodash npm http GET https://registry.npmjs.org/compulsive npm http GET https://registry.npmjs.org/serialport npm http GET https://registry.npmjs.org/temporal npm http GET https://registry.npmjs.org/async npm http GET https://registry.npmjs.org/socket.io npm http GET https://registry.npmjs.org/keypress npm http GET https://registry.npmjs.org/optimist npm http 304 https://registry.npmjs.org/colors npm http 304 https://registry.npmjs.org/firmata npm http 304 https://registry.npmjs.org/es6-collections npm http 304 https://registry.npmjs.org/descriptor npm http 304 https://registry.npmjs.org/lodash npm http 304 https://registry.npmjs.org/compulsive npm http 304 https://registry.npmjs.org/serialport npm http 304 https://registry.npmjs.org/temporal npm http 304 https://registry.npmjs.org/async npm http 304 https://registry.npmjs.org/socket.io npm http 304 https://registry.npmjs.org/optimist npm http 304 https://registry.npmjs.org/keypress npm http GET https://registry.npmjs.org/wordwrap npm http GET https://registry.npmjs.org/socket.io-client/0.9.16 npm http GET https://registry.npmjs.org/base64id/0.1.0 npm http GET https://registry.npmjs.org/policyfile/0.0.4 npm http GET https://registry.npmjs.org/redis/0.7.3 npm http GET https://registry.npmjs.org/bindings/1.1.0 npm http GET https://registry.npmjs.org/async/0.1.18 npm http GET https://registry.npmjs.org/sf/0.1.6 npm http 304 https://registry.npmjs.org/wordwrap npm http 304 https://registry.npmjs.org/policyfile/0.0.4 npm http 304 https://registry.npmjs.org/base64id/0.1.0 npm http 304 https://registry.npmjs.org/redis/0.7.3 npm http 304 https://registry.npmjs.org/socket.io-client/0.9.16 npm http GET https://registry.npmjs.org/socket.io-client/-/socket.io-client-0.9. 16.tgz npm http 304 https://registry.npmjs.org/bindings/1.1.0 npm http 304 https://registry.npmjs.org/async/0.1.18 npm http 304 https://registry.npmjs.org/sf/0.1.6 > serialport@1.1.3 install C:\Users\User\node_modules\johnny-five\node_modules \serialport > node-gyp rebuild C:\Users\User\node_modules\johnny-five\node_modules\serialport>node "C:\Progra m Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bi n\node-gyp.js" rebuild gyp ERR! configure error gyp ERR! stack Error: Command failed: ImportError: No module named site gyp ERR! stack gyp ERR! stack at ChildProcess.exithandler (child_process.js:637:15) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) gyp ERR! stack at maybeClose (child_process.js:735:16) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:802: 5) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu les\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\User\node_modules\johnny-five\node_modules\serialport gyp ERR! node -v v0.10.15 gyp ERR! node-gyp -v v0.10.6 gyp ERR! not ok npm ERR! weird error 1 npm http 200 https://registry.npmjs.org/socket.io-client/-/socket.io-client-0.9. 16.tgz npm ERR! not ok code 0 

我在mac上有同样的问题,但通过安装xcode命令行组件来解决这个问题,但是不知道如何解决这个问题。

谢谢你的帮助!

(这和Owen的回答非常相似,只是添加了一些陷阱 – 但我还不能评论,所以…)

我刚刚在Windows 8上工作,但怀疑它也适用于Win7:

对于arduino本身,请记住检查驱动程序( http://arduino.cc/en/Guide/windows ),我必须将com端口喂给Johnny Five( https://github.com/rwaldron/johnny-five /blob/master/docs/board-with-port.md )。

好的,我在Windows中有一个类似的问题。 您必须安装Visual Studio 2012/2010。 我安装了Vs2012所以我用交换机运行了npm命令

 npm install johnny-five --msvs_version=2012 

这解决了我的问题。 基本上,johnny 5中的serialport软件包需要为操作系统重新构build,所以它需要运行nodegyp包来查找MSBuild

我不知道你的具体错误,但我有很多不同的node-gyp相关的错误与Windows上的npm安装,直到我卸载所有的Visual Studio产品,并按照https://github.com/TooTallNate/node-gyp包括具体的Visual Studio 2010(不是2012年没有工作),SDK和SDK更新。 在我遵循这些步骤之后,我停止了一些错误(包括几分钟前成功完成了Johnny Five的testing安装,如果您还没有按照这些步骤操作,也许值得一试。

确保你有所有必需的软件来运行node-gyp

您可以通过环境variablesconfiguration--msvs_version=2012使用的Visual Studio版本,这样您就可以避免设置--msvs_version=2012属性。

例子:

  • 为Visual Studio 2012设置GYP_MSVS_VERSION=2012 2012
  • 设置GYP_MSVS_VERSION=2013e ('e'代表'express edition')

有关完整列表,请参阅 – https://github.com/joyent/node/blob/v0.10.29/tools/gyp/pylib/gyp/MSVSVersion.py#L209-294

对于NodeJS的Windows用户来说,这仍然很痛苦,因为它假设你已经安装了Python和Visual Studio的副本,许多最终用户永远不会拥有这个。 所以我正在向Joyent游说,鼓励他们将Web套接字作为CORE节点的一部分,同时也可能将GNU gcc编译器作为NodeJS安装的一部分,以便我们可以永久解决这个问题。

随时添加您的投票在: