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脚本 - Caress。但我不能。我使用的是Windows 8.1,任何人都可以告诉我我面临的问题是什么,为什么这个安装无法正常工作。 buffertools依赖似乎存在问题,就像我能想到的那样。不知道怎么解决这个问题?
如果我从github下载构建并将其放在节点模块中,似乎没有任何工作。当我尝试启动时,使用npm start或执行期间。
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>
答案 0 :(得分:358)
https://github.com/nodejs/node-gyp/issues/629#issuecomment-153196245
某些npm插件需要安装 node-gyp
。
但是, node-gyp
拥有自己的依赖关系(from the github page):
如果您使用的是Windows,现在可以使用单个命令安装所有node-gyp
个依赖项(注意:在Windows PowerShell中运行为管理员):
$ npm install --global --production windows-build-tools
然后安装包
$ npm install --global node-gyp
https://github.com/nodejs/node-gyp/issues/809#issuecomment-155019383
删除$ HOME / .node-gyp目录,然后重试。
请参阅此处的完整文档:node-gyp
答案 1 :(得分:16)
确保您拥有运行node-gyp
所需的所有软件:
您可以通过环境变量配置node-gyp
使用的Visual Studio版本,这样您就可以避免每次执行npm安装时都设置--msvs_version=2012
属性。
示例:
GYP_MSVS_VERSION=2012
GYP_MSVS_VERSION=2013e
('e'代表免费'快递版')有关完整列表,请参阅 - https://github.com/joyent/node/blob/v0.10.29/tools/gyp/pylib/gyp/MSVSVersion.py#L209-294
对于NodeJS的Windows用户来说,这仍然很痛苦,因为它假设您安装了Visual Studio的副本,并且许多最终用户永远不会拥有此。因此,我正在游说Joyent鼓励他们将Web套接字作为CORE节点的一部分包含在内,并且可以将GNU gcc编译器作为NodeJS安装的一部分发布,这样我们就可以永久性地解决这个问题。
随时添加您的投票:
答案 2 :(得分:10)
我遇到了错误的问题:
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
错误强>: gyp ERR!配置错误 gyp ERR!堆栈错误:无法找到Python可执行文件&#34; python&#34;,您可以设置PYT HON env变量。
发现:&#39;哪个python&#39;在bash shell上清楚地显示了&#39; / usr / bin / python&#39;。现在这很烦人!
解决方案:这仅适用于那些使用类似于我的环境的人,即使用cygwin和bash shell。希望它在其他环境中也有帮助,但请记住,你的茶壶可能看起来与我的有点不同。
导出PYTHON =&#34; C:/cygwin64/bin/python2.7.exe(或者系统上的任何版本)&#34;
你现在应该没事了,gyp会找到python可执行文件。
我希望这有助于某人绊倒相同或类似的问题。
答案 3 :(得分:2)
应该能够使用chocolatey for Windows
获取所有node-gyp依赖项{{1}}
答案 4 :(得分:2)
在NodeJs网站下载安装程序。您可以下载最新的V6
Npm与Node.js一起安装。所以别担心。
Anaconda是由Python提供支持的领先开放数据科学平台。 Anaconda的开源版本是Python的高性能发行版。它可以帮助您管理您的python依赖项。如果你想触摸它,可以使用它来创建不同的python环境。
Node-gyp仅支持&gt; = Python 2.7和&lt; Python 3.0
所以只需安装2.7版本
您可以使用npm
安装:
$ npm install -g node-gyp
您还需要安装:
在Windows上:
选项1:使用Microsoft的windows-build-tools使用npm install --global --production windows-build-tools
从提升的PowerShell或CMD.exe(以管理员身份运行)安装所有必需的工具和配置。
选项2:手动安装工具和配置:
Visual C ++构建环境:
[仅限Windows Vista / 7]需要.NET Framework 4.5.1
启动cmd,npm config set msvs_version 2015
如果上述步骤不适合您,请访问Microsoft's Node.js Guidelines for Windows获取更多提示。
如果您安装了多个Python版本,则可以通过设置'--python'变量来识别哪个Python版本node-gyp
:
$ node-gyp --python C:/Anaconda2/python.exe
如果通过node-gyp
和调用npm
,您安装了多个版本的Python,那么您可以设置npm
的'python'配置关键是适当的值:
$ npm config set python C:/Anaconda2/python.exe
从官方网站下载安装程序并直接安装。安装程序将自动帮助您删除旧文件。
npm update npm
conda update --all
答案 5 :(得分:1)
在开箱即用的Cygwin安装中使用npm
的python问题是node-gyp
由于{{1}中的检查不完整而导致误导error代码。
这是由于Cygwin如何处理符号链接。它在开箱即用的安装中没有做到这一点。因此,来自上述代码的错误消息会产生误导,因为它抱怨../npm/node_modules/node-gyp/lib/configure.js
路径,而不是PYTHON
(或链接)文件本身。
有(至少)两种方法可以解决这个问题。
python.exe
并使用cygutils-extra
。 对于( 1 ),您可以通过以下步骤从Cygwin shell中创建正确的符号链接:
winln
(还假设您以管理员身份运行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"
,可以在github上找到各种形式。
对于( 2 ),开箱即用的Cygwin用户的分辨率为:
apt-cyg
结果应如下所示:
# Open a native Windows CMD in Administrator mode and:
cd C:\cygwin64\bin\
mklink python.exe python2.7.exe
答案 6 :(得分:1)
适用于Windows
检查系统变量中的python路径。 npm插件需要安装node-gyp。
使用管理员权限打开命令提示符,然后运行以下命令。
npm install --global --production windows-build-tools
npm install --global node-gyp
答案 7 :(得分:0)
gyp ERR!配置错误gyp ERR!堆栈错误:找不到Python 可执行文件“python”,可以设置PYT HON env变量。
这意味着Python环境。变量应指向可执行的python文件,在我的情况下:
SET PYTHON=C:\work\_env\Python27\python.exe
答案 8 :(得分:0)
对我来说解决方案是:
rm -rf ~/.node_gyp and
sudo npm install -g node-gyp@3.4.0
cd /usr/local/lib sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib
brew install gcc
npm install
答案 9 :(得分:0)
我正在通过npm install -g appium安装appium并在Windows 10上获得相同的错误。
以下命令对我有用:
npm --add-python-to-path='true' --debug install --global windows-build-tools
https://github.com/felixrieseberg/windows-build-tools/issues/33
答案 10 :(得分:0)
这个问题已经得到解答,但这些问题在我的情况下不起作用,这是基于Linux的高级操作系统,所以这可能会帮助其他人。
我也得到同样的错误
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
因此,如果你在Dockerfile中工作或者在OS
中安装它,那么只需单行修复即可apk add --no-cache python nodejs
在ubuntu中
sudo apt-get install python3.6
注意:节点版本:8
答案 11 :(得分:0)
安装node-gyp和c ++编译器(gcc-c ++)。
答案 12 :(得分:0)
修复了将Node从v12.8.1降级到v11.15.0并成功安装所有内容的问题
答案 13 :(得分:0)
npm install --global --production windows-build-tools
答案 14 :(得分:0)
我正在开发一个旧的 Vue 2.x 项目,至少有 2 年的历史,而且 deps 从未更新过。恢复到 Node v10.16.3 对我有用。版本 14 和 12 不起作用。