Node.js 无法安装';弱';通过npm安装模块

Node.js 无法安装';弱';通过npm安装模块,node.js,npm,prerender,Node.js,Npm,Prerender,我正在尝试使用node express server设置prerender.io,但在系统上设置时遇到问题。我使用windows 10并安装了nodejs来使用npm包。我安装了prerenderjs、node server和phantomjs来启动node express server的SEO。 当我运行'node server.js'时,它会因为缺少模块'weak'而给出以下错误,我认为这是运行prerender.io的一些依赖项 2015-10-20T07:50:10.331Z worke

我正在尝试使用node express server设置prerender.io,但在系统上设置时遇到问题。我使用windows 10并安装了nodejs来使用npm包。我安装了prerenderjs、node server和phantomjs来启动node express server的SEO。 当我运行'node server.js'时,它会因为缺少模块'weak'而给出以下错误,我认为这是运行prerender.io的一些依赖项

2015-10-20T07:50:10.331Z worker 32 died, restarting!
2015-10-20T07:50:10.768Z starting phantom on port [12334]
2015-10-20T07:50:10.783Z starting phantom on port [12333]
2015-10-20T07:50:10.807Z starting phantom on port [12335]
2015-10-20T07:50:10.866Z Server running on port 3000
2015-10-20T07:50:10.866Z Server running on port 3000
2015-10-20T07:50:10.866Z Server running on port 3000
2015-10-20T07:50:11.018Z starting phantom on port [12336]
2015-10-20T07:50:11.043Z Server running on port 3000
module.js:338
throw err;
^

Error: Cannot find module 'weak'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at new D (C:\prerender-master\node_modules\phantom\node_modules\dnode\index.js:28:20)
at module.exports (C:\prerender-master\node_modules\phantom\node_modules\dnode\index.js:8:12)
at C:\prerender-master\node_modules\phantom\phantom.js:159:13
at Server.handler (C:\prerender-master\node_modules\phantom\node_modules\shoe\index.js:22:9)
at emitOne (events.js:77:13)
at Server.emit (events.js:169:7)
2015-10-20T07:50:12.209Z worker 34 died, restarting!
然后我尝试通过npm安装'weak',就像

npm install weak
但它给出了以下错误

npm WARN package.json prerender@3.22.1 No license field.
-
> weak@1.0.0 install C:\prerender-master\node_modules\weak
> node-gyp rebuild


C:\prerender-master\node_modules\weak>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-    bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v3.5.0, which is not     supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (C:\Program     Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:121:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:110:9
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:194:7)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:817:16)
gyp ERR! stack     at Socket.<anonymous> (internal/child_process.js:319:11)
gyp ERR! stack     at emitOne (events.js:77:13)
gyp ERR! stack     at Socket.emit (events.js:169:7)
gyp ERR! stack     at Pipe._onclose (net.js:469:12)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js"   "rebuild"
gyp ERR! cwd C:\prerender-master\node_modules\weak 
gyp ERR! node -v v4.1.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program     Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "weak"
npm ERR! node v4.1.0 
npm ERR! npm  v2.14.3
npm ERR! code ELIFECYCLE

npm ERR! weak@1.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the weak@1.0.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the weak 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 weak
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\prerender-master\npm-debug.log
npm WARN package.jsonprerender@3.22.1没有许可证字段。
-
> weak@1.0.0安装C:\prerender master\node\u modules\weak
>节点gyp重建
C:\prerender master\node\u modules\weak>如果未定义npm\u config\u node\u gyp(节点“C:\Program Files\nodejs\node\u modules\npm\bin\node gyp-bin\\\\\\\\\\\\\\\\\\\\ node\node gyp.js”重建)否则(节点重建)
哎呀!配置错误
哎呀!堆栈错误:Python可执行文件“Python”是v3.5.0,gyp不支持它。
哎呀!堆栈您可以传递--python开关指向python>=v2.5.0&<3.0.0。
哎呀!FailPythVersion时堆栈(C:\Program Files\nodejs\node\u modules\npm\node\u modules\node gyp\lib\configure.js:121:14)
哎呀!堆栈位于C:\Program Files\nodejs\node\u modules\npm\node\u modules\node gyp\lib\configure.js:110:9
哎呀!在ChildProcess.exithandler处堆栈(child_process.js:194:7)
哎呀!在emitTwo处堆栈(events.js:87:13)
哎呀!ChildProcess.emit处的堆栈(events.js:172:7)
哎呀!maybeClose的堆栈(内部/child_process.js:817:16)
哎呀!在插座处堆叠。(内部/child_process.js:319:11)
哎呀!emitOne上的堆栈(events.js:77:13)
哎呀!堆栈位于Socket.emit(events.js:169:7)
哎呀!在管道处堆放。一旦关闭(net.js:469:12)
哎呀!系统Windows\u NT 10.0.10240
哎呀!命令“C:\\Program Files\\nodejs\\node.exe”C:\\Program Files\\nodejs\\node\u modules\\npm\\node\u modules\\node gyp\\bin\\node gyp.js“重建”
哎呀!cwd C:\prerender master\node\u modules\weak
哎呀!节点-v4.1.0
哎呀!节点gyp-v3.0.3
哎呀!不好
npm错误!Windows\u NT 10.0.10240
npm错误!argv“C:\\Program Files\\nodejs\\node.exe”“C:\\Program Files\\nodejs\\node\u modules\\npm\\bin\\npm cli.js”“安装”“弱”
npm错误!节点v4.1.0
npm错误!npm v2.14.3
npm错误!代码失效循环
npm错误!weak@1.0.0安装:`node gyp rebuild`
npm错误!退出状态1
npm错误!
npm错误!失败weak@1.0.0安装脚本“节点gyp重建”。
npm错误!这很可能是软包装的问题,
npm错误!与npm本身无关。
npm错误!告诉作者此操作在您的系统上失败:
npm错误!节点gyp重建
npm错误!您可以通过以下方式获取他们的信息:
npm错误!npm所有者是弱者
npm错误!上面可能还有其他日志输出。
npm错误!请在任何支持请求中包括以下文件:
npm错误!C:\prerender master\npm-debug.log
我还尝试了npm安装节点gyp,然后再次尝试安装'weak',但出现了相同的错误。我搜索了错误,但无法理解解决方案。我将非常感谢你的帮助。谢谢

哎呀!堆栈错误:Python可执行文件“Python”是v3.5.0,它是 gyp不支持。哎呀!堆栈,您可以传递--python 切换到Python>=v2.5.0&<3.0.0


看起来您只需要提供不同版本的Python

即使我没有使用phantomjs,node.js服务器上也会出现相同的错误。但是node.js服务器抛出了一个错误,
找不到模块“弱”
。它在Aws Ec2实例上导致此错误。在本地机器上,它工作正常,但在Aws EC2上抛出一个错误。我在AWSEC2上安装了python 2.7.15rc1。我怎样才能解决它?