Windows 上的 node-gyp 安装失败 [英] node-gyp installation failures on Windows

查看:215
本文介绍了Windows 上的 node-gyp 安装失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 节点版本:node -v 和 npm -v
  • Node Version: node -v and npm -v

节点 v8.11.2

npm v6.0.1

  • 平台:uname -a (UNIX) 或 systeminfo |findstr/B/C:"操作系统名称"/C:"操作系统版本"/C:"系统类型" (Windows)
  • Platform: uname -a (UNIX), or systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type" (Windows)

视窗

  • 编译器:(UNIX) 或 `msbuild/version &cl</code> (Windows) --> Windows
  • 模块:节点画布
  • Compiler: (UNIX) or `msbuild /version & cl</code> (Windows) --> Windows
  • Module: node canvas

详细输出(来自 npm 或 node-gyp):

Verbose output (from npm or node-gyp):

我尝试根据 node-gyp 存储库上的 windows 说明从 npm 安装 node-gyp:https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules

I have tried to install node-gyp from npm according to the instructions for windows on the node-gyp repo: https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules

我安装了 python 2.7

I have python 2.7 installed

我已将 npm 配置设置更改为指向正确版本的 python

I have changed the npm config setting to point to the right version of python

我按照 option2 说明进行操作,并且 GTK 运行正常.我在运行 cmd 时看到了 GTK 的演示小部件.

I followed the option2 instructions and I have GTK running correctly. I see the demo widget for GTK when I run the cmd.

我输入下一个命令:

node-gyp rebuild --GTK_Root=C:\Users\davidlop\Documents\Software\GTK

我得到的只是:bash:node-gyp:找不到命令

and all I get is: bash: node-gyp: command not found

我已经尝试了所有修复,我已经卸载并重新安装了 node npm.

I have tried every fix, I have uninstalled and reinstalled node npm.

我已按照信中的说明进行操作.我该如何安装?我正在尝试使用节点画布并且需要 node-gyp ......我做错了什么?

I have followed the instructions to the letter. How do I install this? I am trying to work with node canvas and node-gyp is required... What am I doing wrong?

```

我忘记了日志及其位置.一旦我取得一些进展和新日志,我就会发布.

I lost track of the log and where it is. Once I get some progress and a new log I will post.

我还将 $PATH/users/AppData/Roaming/npm 目录添加到我的路径中.我得到的错误是:

Also I added my $PATH/users/AppData/Roaming/npm directory to my PATH. The error I get is:

错误:找不到模块C:\Program Files\Git\node_modules\node-gyp\bin\node-gyp.js"

```

推荐答案

确保您已全局安装 node-gyp.查看您的问题,node-gyp.js 文件似乎在指定路径中不可用.

Make sure you have installed node-gyp globally. Looking on your issue it seems that node-gyp.js file is not available in the specified path.

Windows 的 Node Gyp 安装

Node Gyp installation for Windows

npm install -g node-gyp

全局安装 node-gyp 后,以管理员的身份打开命令提示符并运行以下命令安装窗口构建工具.

After installing node-gyp globally, Open command prompt as an Administrator and run the following command to install window build tools.

npm install --global --production windows-build-tools

安装后,运行以下命令重建您的 GTK.

After installation, Run the following command to rebuild your GTK.

node-gyp rebuild --GTK_Root=C:\Users\davidlop\Documents\Software\GTK

这篇关于Windows 上的 node-gyp 安装失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆