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! 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可执行文件。

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

其他回答

对于Cygwin用户:

在开箱即用的Cygwin安装中使用npm的python问题是,node-gyp由于在../npm/node_modules/node-gyp/lib/configure.js代码中不完全检查而给出了一个误导性的错误。

这是由于Cygwin如何对待符号链接。在开箱即用的安装中,它不能正确地做到这一点。因此,来自上述代码的错误消息变得具有误导性,因为它抱怨PYTHON路径,而不是PYTHON .exe(或链接)文件本身的存在。

有(至少)两种方法来解决这个问题。

安装Cygwin包cygutils-extra并使用winln。 在管理模式下使用本机Windows CMD。


对于(1),你可以通过以下步骤在Cygwin shell中创建一个合适的符号链接:

# To make the Cygwin environment treat Windows links properly: 
# Alternatively add this to your `.bashrc` for permanent use.
export CYGWIN=winsymlinks:nativestrict

# Install Cygwin package containing "winln"
apt-cyg install cygutils-extra

# Make a proper Windows sym-link:
cd /cygdrive/c/cygwin64/bin/
winln.exe -s python2.7.exe python.exe

# Add PYTHON as a native Windows system wide variable (HKLM) 
setx /M PYTHON "C:\cygwin64\bin\python"

(同时假设您以Admin身份运行Cygwin shell。) 推荐使用apt-cyg,可以在github上以各种形式找到。


对于(2)开箱即用的Cygwin用户的分辨率如下:

# Open a native Windows CMD in Administrator mode and:
cd C:\cygwin64\bin\
mklink python.exe python2.7.exe

结果应该是这样的:

C:\cygwin64\bin>ls -al python*
lrwxrwxrwx 1 xxx            xxx   13 Jun  2  2015 python -> python2.7.exe
lrwxrwxrwx 1 Administrators xxx   13 Aug 24 17:28 python.exe -> python2.7.exe
lrwxrwxrwx 1 xxx            xxx   13 Jun  2  2015 python2 -> python2.7.exe
-rwxr-xr-x 1 xxx            xxx 9235 Jun  2  2015 python2.7.exe

对于windows

检查系统变量中的python路径。 NPM插件需要node-gyp来安装。

以管理员权限打开命令提示符,运行以下命令。

NPM install -global -production windows-build-tools

NPM install——global node-gyp

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

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

这个问题已经有了答案,但这些在我的情况下都不起作用,因为我是基于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

NPM install -global -production windows-build-tools