【问题标题】:How to install win32ole for nodejs (i.e. making node-gyp work properly)如何为 nodejs 安装 win32ole(即让 node-gyp 正常工作)
【发布时间】:2015-10-15 10:39:25
【问题描述】:

对不起,我是 nodejs 的新手。我想试试windows7下nodejs中的包win32ole,但是当我在以管理员身份打开的命令提示符窗口中运行安装命令npm install win32ole时,弹出很多错误。

我的配置是:

  • Windows 7 64 位(版本 6.1.7601)
  • 适用于 Windows 桌面的 Microsoft Visual Studio Express 2015 - ENU(恕我直言,必须安装 20GB 的软件才能尝试使 node-gyp 正常工作,这就像某个 IT 模型的故障证明)
  • Microsoft .NET Framework 4.6
  • Python 2.7.9 和 3.4.3 都已安装,但我将 python 命令指向 2.7.9
  • nodejs 版本 4.2.1
  • npm 版本 2.14.7
  • 节点-gyp 3.0.3
  • PYTHON 环境变量设置为C:\Python27\python.exe
  • 告诉node-gyp 在哪里可以找到Python 命令node-gyp --python C:\Python27\
  • 告诉npm 在哪里可以找到Python 命令npm config set python C:\Python27\python.exe

这是控制台输出:

C:\Windows\system32
>npm install win32ole
Impossibile trovare il percorso specificato.
npm WARN engine win32ole@0.1.3: wanted: {"node":">= 0.8.18 && < 0.9.0"} (current: {"node":"4.2.1","npm":"2.14.7"})
\
> ref@1.2.0 install C:\Windows\system32\node_modules\win32ole\node_modules\ref
> node-gyp rebuild


C:\Windows\system32\node_modules\win32ole\node_modules\ref
>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Impossibile trovare il percorso specificato.
gyp: Call to 'node -e "require('nan')"' returned exit status 1. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:355:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Windows\system32\node_modules\win32ole\node_modules\ref
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "win32ole"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

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

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Windows\system32\npm-debug.log

关于我做错了什么的任何线索?

跟进

我想我没有做错什么,Windows下的包node-gyp,正如评论中指出的那样,有一些问题:https://github.com/nodejs/node-gyp/issues/629

【问题讨论】:

    标签: node.js installation windows-7-x64 win32ole


    【解决方案1】:

    使用最新的 node.js 版本是不可能的。

    使用node winax

    【讨论】:

      【解决方案2】:

      首先,由于节点版本,您有一个警告

      npm WARN engine win32ole@0.1.3: wanted: {"node":">= 0.8.18 && < 0.9.0"} (current: {"node":"4.2.1","npm":"2.14.7"})
      

      应该低于0.9.0

      您是否安装了 node-gyp?我看到很多抱怨它的错误。 如果没有,您可以使用此命令安装它

      npm install -g node-gyp
      

      【讨论】:

      • 我在安装win32ole 之前手动安装了node-gyp,但错误仍然存​​在。请参阅我更新的问题。
      • 您是否尝试过使用旧版本的节点,只是为了查看是否是新版本导致问题?我这么说是因为作者明确规定了一个上限。
      • 在那之后,我意识到试图让node-gyp 工作只是浪费时间。无论如何,谢谢。
      • 取决于我从来没有遇到过问题,但我安装了许多 Windows sdk 和所有 .Net 运行时
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-05-25
      • 2014-02-07
      • 1970-01-01
      • 2019-07-22
      • 1970-01-01
      • 2015-12-07
      • 2020-01-05
      相关资源
      最近更新 更多