Skip to content

常见问题列表

padlocal edited this page May 12, 2021 · 6 revisions

本文罗列了在使用 PadLocal 过程中,不同平台上出现的一些比较常见的问题,希望能够帮助你解决问题。

1. npm install 安装阶段

一旦出现错误,建议详细阅读 ERROR 错误信息,会有助于解决问题。

1.1 gyp ERR!

描述

因为 PadLocal 使用的某些依赖(特别是 better-sqlite3)是 node native module。所以 npm install 会通过 gyp 编译项目,这个过程中不同平台上可能出现错误。

特别是 Windows 平台,因为缺少 node build tool,比较容易出现这个错误。

点击查看错误日志
prebuild-install WARN install No prebuilt binaries found (target=12.14.1 runtime=node arch=x64 libc= platform=win32)

> [email protected] build-release C:\...\node_modules\better-sqlite3    
> node-gyp rebuild --release


C:\..\node_modules\better-sqlite3>if not defined npm_config_node_gyp (node "v12.14.1\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )  else (node "\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )
gyp ERR! find VS 
gyp ERR! find VS msvs_version was set from command line or npm config
gyp ERR! find VS - looking for Visual Studio version 2017
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS valid versions for msvs_version:
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack     at VisualStudioFinder.fail (...\nvm\v12.14.1\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack     at ...\nvm\v12.14.1\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack     at Vis

解决方案

1.2 其他错误

如果 npm install 安装失败且无法确定原因,建议进行如下操作:

解决方案

a) 检查 node 版本

$ node -v
v14.15.4
  • 推荐 node 版本 是 14 lts。如果你使用的版本过低(<12)或过高(>=15),可能出现未知问题。

b) 再完全删除 node_modules 目录重新运行 npm install

2. npm run demo 启动阶段

2.1 二维码不出现

点击查看错误日志
> [email protected] demo /wechaty-puppet-padlocal-demo
> ts-node main.ts "-"
00:00:01 INFO 
      ============================================================
       Welcome to Wechaty PadLocal puppet!

       - wechaty-puppet-padlocal version: 0.2.47
       - padlocal-ts-client version: 0.2.32
      ============================================================
     
00:00:01 INFO TestBot started.

[EOF]

描述

如果运行npm run demo后,正常情况会提示扫码登录。如果一直卡在 INFO TestBot started,二维码没有出现。可能有几个原因:

2.1.1 网络问题

因为 PadLocal 设计上的独特性(设计理念),对运行 PadLocal 的本地网络有一定要求。请确保你本地网络是否正常:

  1. 本地网络是否能够正常上网
  2. 是否开启了全局的 VPN
  3. 是否设置了网络防火墙
  4. 测试和 PadLocal 服务器之间网络是否通畅
$ ping gateway.pad-local.com
  1. 测试和wx服务器之间网络是否通畅
$ ping long.weixin.qq.com
$ ping short.weixin.qq.com

2.1.2 node 版本问题

推荐 node 版本 是 14 lts。如果你使用的版本过低(<12)或过高(>=15),可能出现未知问题。检查 node 版本:

$ node -v
v14.15.4

3. 仍有疑问

如果您还遇到其他问题,可以通过如下方法向我们反馈:

  1. 提交 issue:https://github.com/padlocal/wechaty-puppet-padlocal/issues
  2. 添加 PadLocal 技术支持咨询。 wechat_cs