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>

当前回答

正如下面所评论的,你可能不需要在窗口上安装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

其他回答

应该能够得到所有的节点gyp依赖巧克力为Windows

choco install python2
choco install visualstudioexpress2013windowsdesktop

正如下面所评论的,你可能不需要在窗口上安装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

对于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

安装node-gyp和c++编译器(gcc-c++)。

对于windows

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

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

NPM install -global -production windows-build-tools

NPM install——global node-gyp