【问题标题】:Unable to install contextify on Windows无法在 Windows 上安装 contextify
【发布时间】:2015-09-04 06:46:37
【问题描述】:

这是我尝试安装 contextify 时返回的内容:

npm install contextify
npm WARN install Couldn't install optional dependency: Unsupported
npm WARN install Couldn't install optional dependency: Unsupported

> contextify@0.1.14 install F:\_vms\HomesteadCode\_live\misc\web-react\node_modules\contextify
> node-gyp rebuild


F:\_vms\HomesteadCode\_live\misc\web-react\node_modules\contextify>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
gyp: F:\Program Files (x86)\nodejs\common.gypi not found (cwd: F:\_vms\HomesteadCode\_live\misc\web-react\node_modules\contextify) while reading includes of binding.gyp 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 (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:357:16)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd F:\_vms\HomesteadCode\_live\misc\web-react\node_modules\contextify
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "contextify"
npm ERR! node v0.12.7
npm ERR! npm  v3.3.1
npm ERR! code ELIFECYCLE

npm ERR! contextify@0.1.14 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify@0.1.14 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the contextify 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 contextify
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     F:\_vms\HomesteadCode\_live\misc\web-react\npm-debug.log

更新: 安装好了……也许很难。

  • 已安装 Visual Studio 2013(2015 年删除)
  • 确保我有最新的 nodejs
  • 清理了环境路径。 (结帐Rapidee
  • 添加系统变量:(我的:set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120
  • 从我的全局 node_modules(对我来说是 F:\Program Files\nodejs\node_modules\npm\node_modules)我克隆了 repo git clone git@github.com:brianmcd/contextify.git。光盘进入然后rm -rf .git
  • 我不得不下一个npm i nan
  • node-gyp rebuild

安装后没有任何抱怨!!!!

希望有人提出比这更好的解决方案!!!

【问题讨论】:

  • 关于上述错误消息的一部分:“F:\Program Files (x86)\nodejs\common.gypi not found”,“common.gypi”不在该目录或我发现的其他任何地方可以立即分辨。

标签: node.js windows


【解决方案1】:

这是 windows 上 python 的问题 (https://github.com/nodejs/node-gyp/issues/629)

您可能对此无能为力。您可以尝试一些他们在 cmets 中建议的解决方法,但我不知道它会对您有多大帮助。

【讨论】:

  • 据我所知,Python 似乎不是罪魁祸首。
【解决方案2】:

看看这个链接:

common.gypi not found error in node.js

这几天似乎是一个普遍的问题。

您可以查看https://github.com/TooTallNate/node-gyp/issues/313https://github.com/TooTallNate/node-gyp/issues/376 看看有没有 这些解决方案可以解决您的问题。

特别是,您可以:

  1. 删除旧目录 ~/.node_gyp 并运行 npm install

  2. 将旧版本(例如:~/.node-gyp/0.10.11/)复制到符合的路径。

  3. 将最新版本复制到符合的路径。

  4. 点击此主题以获得帮助。

PS:

当我尝试在 Windows 上安装时,我得到一个完全不同的错误:

d:\temp>npm install -g contextify
> contextify@0.1.14 install C:\Users\paulsm\AppData\Roaming\npm\node_module\contextify
> node-gyp rebuild

C:\Users\paulsm\AppData\Roaming\npm\node_modules\contextify>node "D:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (D:\Program Files\nodejs\node_module\npm\node_modules\node-gyp\lib\configure.js:103:14)
<= NOTE: This is *not* your problem

当我在 Linux 机器上运行 sudo npm install -g contextify 时……“一切正常”。

再次 - 请查看上面的链接,看看它们是否有帮助。

【讨论】:

  • Python 没有任何明显的问题。我已经浏览了您提到的链接以及更多链接。我也安装了最新的 MSVS 2015。
  • 我同意 - 听起来 Python 并不是罪魁祸首。问:您是否阅读过“将旧版本(例如:~/.node-gyp)复制到符合路径”的部分?
  • 不,我没有尝试“复制旧版本”部分。我真的必须吗? :(
猜你喜欢
  • 2023-03-30
  • 2020-02-17
  • 2017-08-09
  • 2016-05-20
  • 2017-10-08
  • 2017-04-13
  • 2018-01-08
  • 2020-05-08
  • 2018-11-26
相关资源
最近更新 更多