Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Windows\system32>npm install caress-server
npm http GET https://registry.npmjs.org/caress-server
npm http 304 https://registry.npmjs.org/caress-server
npm http GET https://registry.npmjs.org/jspack/0.0.1
npm http GET https://registry.npmjs.org/buffertools
npm http 304 https://registry.npmjs.org/jspack/0.0.1
npm http 304 https://registry.npmjs.org/buffertools

> buffertools@2.0.1 install C:\Windows\system32\node_modules\caress-server\node_
modules\buffertools
> node-gyp rebuild


C:\Windows\system32\node_modules\caress-server\node_modules\buffertools>node "G:
\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 PYT
HON env variable.
gyp ERR! stack     at failNoPython (G:\nodejs\node_modules\npm\node_modules\node
-gyp\lib\configure.js:101:14)
gyp ERR! stack     at G:\nodejs\node_modules\npm\node_modules\node-gyp\lib\confi
gure.js:64:11
gyp ERR! stack     at Object.oncomplete (fs.js:107:15)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "G:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\
bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Windows\system32\node_modules\caress-server\node_modules\buffert
ools
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! buffertools@2.0.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the buffertools@2.0.1 install script.
npm ERR! This is most likely a problem with the buffertools 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 buffertools
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "G:\\nodejs\\\\node.exe" "G:\\nodejs\\node_modules\\npm\\bin\\n
pm-cli.js" "install" "caress-server"
npm ERR! cwd C:\Windows\system32
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Windows\system32\npm-debug.log
npm ERR! not ok code 0

C:\Windows\system32>

我正在安装某个NodeJS脚本-爱抚。但我不是不能。我正在使用Windows 8.1,谁能告诉我我面临的问题是什么,为什么这个安装不工作。buffertools的依赖关系似乎有问题,就我所知。不知道如何解决这个问题?

如果我从github下载构建并将其放在节点模块中,似乎什么都不能工作。当我尝试启动时,使用NPM启动,或者在实现期间启动。

G:\nodejs\node_modules\caress-server>npm install

G:\nodejs\node_modules\caress-server>npm start

> caress-server@0.1.1 start G:\nodejs\node_modules\caress-server
> node examples/server.js

   info  - socket.io started

module.js:340
    throw err;
          ^
Error: Cannot find module './build/Release/buffertools.node'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (G:\nodejs\node_modules\caress-server\node_modules\buf
fertools\buffertools.js:16:19)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

npm ERR! caress-server@0.1.1 start: `node examples/server.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the caress-server@0.1.1 start script.
npm ERR! This is most likely a problem with the caress-server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node examples/server.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls caress-server
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "G:\\nodejs\\\\node.exe" "G:\\nodejs\\node_modules\\npm\\bin\\n
pm-cli.js" "start"
npm ERR! cwd G:\nodejs\node_modules\caress-server
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     G:\nodejs\node_modules\caress-server\npm-debug.log
npm ERR! not ok code 0

G:\nodejs\node_modules\caress-server>

当前回答

骗子犯错!配置错误gyp ERR!堆栈错误:找不到Python 可执行的"python",你可以设置PYT HON env变量。

这意味着Python的env。变量应该指向可执行的python文件,在我的情况下: 设置PYTHON = C: \ \ _env \ Python27 \ python.exe工作

其他回答

NPM install -global -production windows-build-tools

我在研究一台旧的Vue 2。X项目,至少2年了,deps从未更新过。恢复到Node v10.16.3对我来说是有效的。版本14和12不起作用。

我遇到了错误的问题:

gyp ERR! configure error

gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.

这是我一直在做的事情,最后成功了。

免责声明:在Java、Linux等领域工作多年后,我刚刚接触Node、Angular……

环境描述:Windows 8.1 64位;Cygwin;Cygwin bash shell

导致错误的命令:npm install -g karma

错误: 骗子犯错!配置错误 骗子犯错!堆栈错误:无法找到Python可执行文件“Python”,您可以设置PYT HON env变量。

发现:'which python'在bash shell上清楚地显示'/usr/bin/python'。这太烦人了!

解决方案:这只适用于那些使用类似于我的环境,即使用cygwin和bash shell。希望在其他环境中也能有所帮助,但请记住,你的茶壶可能看起来和我的有点不同。

Firstly, need to set the $PYTHON shell env variable in .bashrc using the explicit windows path to the python executable and not the unix like root path (/usr/bin) used by cygwin. Secondly, and this one took a lot of trial/error and here's the gotcha! Cygwin installs python under /usr/bin (which is really a mirror of /bin on windows) with the version, i.e. (in my system) /usr/bin/python2.7.exe and then adds a link /usr/bin/python --> python2.7.exe. The problem is that gyp cannot follow this link and keeps giving the annoying error that it cannot find python even though you can find it just fine from the shell command line. With the above background now add the following line to your .bashrc

导出PYTHON="C:/cygwin64/bin/python2.7.exe(或系统上的任何版本)"

现在从你的主目录(在cygwin上)——> 'source .bashrc'

现在应该没问题了,gyp将找到python可执行文件。

我希望这能帮助那些遇到相同或类似问题的人。

正如下面所评论的,你可能不需要在窗口上安装VS,看看这个

https://github.com/nodejs/node-gyp/issues/629#issuecomment-153196245

更新02/2016

一些npm插件需要node-gyp来安装。

然而,node-gyp有它自己的依赖项(来自github页面):

更新09/2016

如果你正在使用Windows,你现在可以用一个命令安装所有node-gyp依赖项(注意:在Windows PowerShell中以管理员身份运行):

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

然后安装包

 $ npm install --global node-gyp

更新06/2018

https://github.com/nodejs/node-gyp/issues/809#issuecomment-155019383

删除$HOME/。Node-gyp目录后重试。

查看完整文档:node-gyp

这个问题已经有了答案,但这些在我的情况下都不起作用,因为我是基于Linux的操作系统,所以也许这对其他人有帮助。

我也得到了同样的错误

gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.

因此,如果你在Dockerfile中工作或在操作系统中安装它,只需添加这个单行即可

apk add --no-cache python nodejs

在ubuntu中

sudo apt-get install python3.6

备注:节点版本号:8