Skip to content

常见问题列表

padlocal edited this page May 13, 2021 · 6 revisions

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

1. npm install 安装阶段

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

1.1 gyp ERR!

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

1.1.1 Could not find any Visual Studio installation to use

描述

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.1.2 not found: make

描述

Linux 系统因为缺 Build Tolls,所以出错。https://github.com/nodejs/node-gyp/issues/1694

点击查看错误日志
[hualife@SHZ-OBS wechaty-puppet-padlocal-demo]$ npm install         

> [email protected] install .../app/wechaty-puppet-padlocal-demo/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

[grpc] Success: ".../app/wechaty-puppet-padlocal-demo/node_modules/grpc/src/node/extension_binary/node-v83-linux-x64-glibc/grpc_node.node" is installed via remote

> [email protected] install .../app/wechaty-puppet-padlocal-demo/node_modules/better-sqlite3
> prebuild-install || npm run build-release

prebuild-install WARN install /lib64/libm.so.6: version `GLIBC_2.29' not found (required by .../app/wechaty-puppet-padlocal-demo/node_modules/better-sqlite3/build/Release/better_sqlite3.node)

> [email protected] build-release .../app/wechaty-puppet-padlocal-demo/node_modules/better-sqlite3
> node-gyp rebuild --release

gyp ERR! build error 
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (.../app/nodejs/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack     at F (.../app/nodejs/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack     at E (.../app/nodejs/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at .../app/nodejs/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at .../app/nodejs/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at .../app/nodejs/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:192:21)
gyp ERR! System Linux 4.18.0-240.1.1.el8_3.x86_64
gyp ERR! command ".../app/nodejs/bin/node" ".../app/nodejs/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd .../app/wechaty-puppet-padlocal-demo/node_modules/better-sqlite3
gyp ERR! node -v v14.17.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build-release: `node-gyp rebuild --release`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build-release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     .../.npm/_logs/2021-05-13T08_03_52_162Z-debug.log
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `prebuild-install || npm run build-release`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     .../.npm/_logs/2021-05-13T08_03_52_886Z-debug.log

解决方案

安装 Build Tools

  • Centos: sudo yum groupinstall "Development Tools"
  • Ubuntu: sudo apt-get install build-essential

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 技术支持咨询。http://pad-local.com/#/contactus