我正在尝试在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命令行组件解决了这个问题,但是不知道如何为windows解决这个问题。
感谢您的帮助!
答案 0 :(得分:1)
(这与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)。
答案 1 :(得分:1)
好的,我在Windows中遇到了类似的问题。您必须安装visual studio 2012/2010。我安装了Vs2012所以我用开关
运行了npm命令npm install johnny-five --msvs_version=2012
这解决了我的问题。基本上johnny的serialport包需要为操作系统重建自己,所以需要运行nodegyp包,它将寻找MSBuild
答案 2 :(得分:0)
我不确定您的具体错误,但我在Windows上安装了npm install时遇到了很多不同的node-gyp相关错误,直到我卸载了所有Visual Studio产品并按照https://github.com/TooTallNate/node-gyp上的说明进行了操作。特别包括Visual Studio 2010(不是2012年不起作用),SDK和SDK更新。在我完全遵循这些步骤之后,我就停止了错误(包括几分钟前Johnny Five的成功测试安装。如果你还没有按照这些步骤进行测试,也许值得一试。
答案 3 :(得分:0)
确保您拥有运行node-gyp
所需的所有软件:
您可以通过环境变量配置gyp
使用的Visual Studio版本,这样您就可以避免设置--msvs_version=2012
属性。
示例:
GYP_MSVS_VERSION=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安装的一部分发布,这样我们就可以永久修复这个问题。
随时添加您的投票: