gpt4 book ai didi

node.js - 无法通过npm install安装 'weak'模块

转载 作者:太空宇宙 更新时间:2023-11-03 22:33:39 26 4
gpt4 key购买 nike

我正在尝试使用 Node Express 服务器设置 prerender.io,但在我的系统上设置时遇到问题。我使用 Windows 10 并安装了 NodeJS 以使用 npm 包。我安装了 prerenderjs 、 Node Server 和 phantomjs 以使用 Node Express 服务器启动 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 install node-gyp ,然后再次尝试安装“weak”,但出现同样的错误。我搜索了错误但无法理解解决方案。我将非常感谢任何帮助。谢谢

最佳答案

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.

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

关于node.js - 无法通过npm install安装 'weak'模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33232490/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com