Giter VIP home page Giter VIP logo

getting-started's Introduction

Wechaty Getting Started Powered by Wechaty

Node.js CI Node.js v16 TypeScript ES Modules

About Wechaty

Wechaty is a Conversational RPA(Robotic Process Automation) SDK(Software Development Kit) for Chatbot Makers. It's well designed with an easy to use API. It supports all operating systems including Linux, OSX, Win32, Docker, and lots of IMs(Instant Messaging services) including WeChat, WeCom, Whatsapp, Lark, Gitter, etc.

As a developer, you can use Wechaty to easily build your bot, effectively manage message sending and receiving, room creation and sending out invitations, contact friends, and delightfully add artificial intelligence between users and your bot.

About Wechaty Getting Started Project

If you are a total beginner to Wechaty, this project is the best starting point for you. You can run it on a Cloud IDE in a couple of steps or on a local setup on your machine as described in the sections below.

If you encounter difficulties or have any questions, you are welcome to ask for help in our Discord Community at https://discord.gg/7q8NBZbQzt.

Notice: the current active version of Wechaty is v1.x which is not compatible with most of the v0.x modules.

Features of Wechaty Getting Started project

  1. It works out of the box on Linux, Mac or Windows.
  2. Supports all puppets like Web, Pad, Windows, and Mac.
  3. It replies with a dong message when it receives a ding message.

Wechaty Getting Started video tutorial

Above is a short run-through of deploying the ding-dong-bot using WeChat, WhatsApp, and WeCom.

Running Wechaty Getting Started Project on a cloud based IDE

The fastest way to getting started with Wechaty is to use a Cloud based IDE for running the Wechaty Getting Started Project. You can either use Gitpod or Google Cloud Shell.

If you are a total beginner, then we recommed Gitpod.

Gitpod is an online and open source platform for automated and ready-to-code development environments. You can click the button below to access a complete setup of Wechaty Getting Started ding-dong BOT project on gitpod. If you have never used gitpod before, you will be required to login using your gitHub account.

GitPod Ready-to-Code

You can learn more about Gitpod ❤️ Wechaty from our blog: Getting Started Without Leaving Your Browser: Wechaty ❤️ Gitpod, @huan, Feb 06, 2021

Using Google Cloud Shell

Google Cloud Shell is an online development and operations environment accessible anywhere with your browser. You can run this project on Google Cloud Shell by clicking the button below.

Open in Cloud Shell

Generated via open-in-cloud-shell

After opening the Google Cloud Shell editor, there should be an open tutorial in the right panel which you can follow to learn more about Wechaty.

Learn more about running this project on Google Cloud Shell from our blog: Google Cloud Shell Tutorials for Wechaty, @huan, Feb 20, 2021

Running Wechaty Getting Started project on your local machine

Prerequisites

For you to run this project on your local machine, you need to:

  1. Have Node.js v16+ installed on your machine. You can run the command node -v on the terminal to check whether you have Node.js installed. If you have it, you should be able to see the version printed on the terminal like v16.13.0. Your version might be different from v16.13.0. If it is not installed or your version is below 16, You need to install the latest version by following the links below:

    Node.js for other platforms can be found at https://nodejs.org/en/download/package-manager/

  2. Have Wechaty Puppet Service TOKEN if you want to use RPA protocols other than Web

Step 1: Clone this Repository

You need to clone this repository to your local machine and then switch to wechaty-getting-started directory by running the commands below.

git clone https://github.com/wechaty/getting-started.git
cd getting-started

Step 2: Install Dependencies

You need to install dependencies by running the command below.

npm install

Step 3: Run the Bot

You can use export to set environment variables in Linux, and use set in Windows. If you run into errors while running this command, check the troubleshooting tips in step 4.

Linux
export WECHATY_LOG=verbose
export WECHATY_PUPPET=wechaty-puppet-wechat
npm start
# the above is equals to the below command:
# npx ts-node examples/ding-dong-bot.ts
Windows
set WECHATY_LOG=verbose
set WECHATY_PUPPET=wechaty-puppet-wechat
npm start
# the above is equals to the below command:
# npx ts-node examples/ding-dong-bot.ts

You are all set!

Step 4: Troubleshooting

If you run into problems while following the above steps, try the options below. You are also welcome to ask questions in our gitter chatroom.

  1. You might also need windows-build-tool if you are using windows:

    npm install windows-build-tools

Working with Different Puppets

In our getting started example, the ding-dong BOT uses wechaty-puppet-wechat4u when WECHATY_PUPPET is not set, which is just for newcomer's convenience.

By default, Wechaty will use the Puppet Service for logging in your bot. You can use other Puppet Provider like Whatsapp Web protocol( wechaty-puppet-whatsapp).

If you want to use a Wechaty Puppet Provider for a different protocol, then you need to specify a puppet service provider name (the same as its NPM name) by setting the WECHATY_PUPPET environment variable.

Thanks to the great contributions from our community, there are many Wechaty Puppets which can be used by Wechaty. They have helped us use protocols like Web, Pad, Mac, and Windows.

Wechaty Puppets

Protocol NPM
Puppet Service wechaty-puppet-service
Whatsapp Web wechaty-puppet-whatsapp
WeChat Web wechaty-puppet-wechat
WeChat Pad wechaty-puppet-padlocal

Visit our website to learn more about Wechaty Puppet Service Providers

For example, if you want to use the padlocal puppet, you should set WECHATY_PUPPET=wechaty-puppet-padlocal before you run npm start. You also need a TOKEN for wechaty-puppet-padlocal which you need to set to the WECHATY_PUPPET_PADLOCAL_TOKEN environment variable. You can apply for the PadLocal TOKEN from here. The code snippets below illustrate what has been described above on Linux/ MacOS and on Windows.

On Linux / macOS

export WECHATY_PUPPET=wechaty-puppet-padlocal
export WECHATY_PUPPET_PADLOCAL_TOKEN='puppet_padlocal_your-token-here'
npm start

On Windows

set WECHATY_PUPPET=wechaty-puppet-padlocal
set WECHATY_PUPPET_PADLOCAL_TOKEN='puppet_padlocal_your-token-here'
npm start

Learn more about installing Wechaty on windows from this blog post.

Advanced tutorials

1. Wechaty Tutorial

Above is a 10 minute video tutorial. It is using version 0.14 or older versions of Wechaty therefore it is also outdated. It is a good way to start if you are new to Wechaty.

2. More Examples

Note: Before you attempt more examples, make sure you have tried out the wechaty getting started project in this repository.

API REFERENCE

  1. Official API Docs: https://wechaty.js.org/docs/api

MORE RESOURCES

1. Docker Wechaty Getting Started

Docker

https://github.com/wechaty/docker-wechaty-getting-started

2. Heroku Wechaty Getting Started

Heroku

https://github.com/wechaty/heroku-wechaty-getting-started

3. Wechaty Home

https://wechaty.github.io

FAQ

1. I can not login with my Wechat account

WeChat account registered after 2017 will not be able to login via Web API. Learn more about it at wechaty/wechaty#872

Solution: You can use Wechaty support protocols other than Web API, such as pad. Learn more at wechaty/wechaty#1296

2. What is a Puppet in Wechaty

The term Puppet in Wechaty is an Abstract Class for implementing protocol plugins. The plugins are the components that help Wechaty to control Wechat and that's the reason why we call it puppet.

The plugins are named PuppetXXX, for example PuppetWeChat is using the google puppeteer to control the WeChat Web API via a chrome browser, PuppetPadchat uses the WebSocket protocol to connect with a Protocol Server for controlling the iPad Wechat program. For more details you can go to Puppet in wiki.

Learn more about Wechaty Puppet from our documentation at Wechaty Puppet

Wechaty Getting Started in Multiple Languages

Wechaty in Python Wechaty in Go Wechaty in Java Wechaty in Scala Wechaty in PHP Wechaty in .NET(C#)

History

main v1.18 (Mar 14, 2022)

Add CQRS Wechaty examples.

v1.11 (Oct 30, 2021)

Branch: v1.11: release v1.11 of Wechaty.

  1. v0.13: Enable ESM (ES Module) support (chatie/tsconfig#16)

v0.8 (Feb 20, 2021)

Open in Cloud Shell

Using Google Cloud Shell for a quick setup!

v0.6 (Feb 11, 2021)

GitPod Ready-to-Code

Using Gitpod for a quick setup!

v0.0.1 (Jan 12, 2017)

Init version

Contributors

contributor contributor contributor contributor contributor contributor contributor contributor

Maintainers

@wechaty/contributors

Copyright & License

  • Code & Docs © 2018-now Huan and Wechaty Contributors
  • Code released under the Apache-2.0 License
  • Docs released under Creative Commons

getting-started's People

Contributors

aherman3 avatar brotherbear2008 avatar chinggg avatar d-vr avatar dependabot-preview[bot] avatar dependabot[bot] avatar fabian4 avatar greenkeeper[bot] avatar hcfw007 avatar huan avatar iskuskov avatar judaschrist avatar lijiarui avatar limingth avatar lizeqiangd avatar nibble0101 avatar qhduan avatar sbis04 avatar snyk-bot avatar ss-zheng avatar suntong avatar tbht avatar vyvy3n avatar windmemory avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

getting-started's Issues

Not fully working with `wechaty@next`

Following from wechaty/wechaty#1440,
I ran and saw the qrcode in terminal previously, then stopped and thought AOK. But,

Today, when I try it out with qrcode scan and login,

  • I found so many error logged onto the terminal, is that normal?

  • Moreover, less than 1 minute after logging in, I see a warning:

    WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:[object Object], timeout:60000
    

And after that, no more messages were able to be processed. I.e., it was able to print the following,

Message#Text(👥Room<rm1>🗣Contact<me>)<hello>

but after the above warning, such Message#Text printing will no longer be there, no matter how many test messages I sent afterwards.

Provide Your Network Information

  1. Where is the location of your server? (i.e. City, or In/Out China) Out China
  2. Which cloud platform(AliYun/Qcloud/DigitalOcean/etc) are you using? None. My Home Internet.

Problem

I'm still unable to make the new v0.17 wechaty fully working for me. See above.

Full Output Logs

$ node -v
v10.5.0

$ npm -v
6.1.0

$ node examples/starter-bot.js
. . . See "Show Logs" for details . . .
Show Logs

The full output logs

$ apt-cache policy nodejs
nodejs:
  Installed: 10.5.0-1nodesource1
  Candidate: 10.5.0-1nodesource1
  Version table:
 *** 10.5.0-1nodesource1 500
        500 https://deb.nodesource.com/node_10.x bionic/main amd64 Packages
        100 /var/lib/dpkg/status
     8.10.0~dfsg-2 500
        500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages

# PASTE FULL LOG OUTPUT AT HERE:
$ $ node examples/starter-bot.js 
22:41:23 INFO Wechaty start() v0.17.75 is starting...
22:41:23 INFO Wechaty initPuppet() using puppet: puppeteer
... qrcode scan ...
https://api.qrserver.com/v1/create-qr-code/?data=https%3A%2F%2Flogin.weixin.qq.com%2Fl%2FQedfpTkz_g%3D%3D&size=220x220&margin=20
Contact<me> login
22:41:57 ERR PuppetPuppeteerEvent onLogin() exception: Error: must logout first before login again!
(node:29598) UnhandledPromiseRejectionWarning: Error: must logout first before login again!
    at PuppetPuppeteer.<anonymous> (/path/to/wechaty-getting-started/node_modules/wechaty-puppet/dist/src/puppet.js:183:23)
    at Generator.next (<anonymous>)
    at /path/to/wechaty-getting-started/node_modules/wechaty-puppet/dist/src/puppet.js:25:71
    at new Promise (<anonymous>)
    at __awaiter (/path/to/wechaty-getting-started/node_modules/wechaty-puppet/dist/src/puppet.js:21:12)
    at PuppetPuppeteer.login (/path/to/wechaty-getting-started/node_modules/wechaty-puppet/dist/src/puppet.js:180:16)
    at PuppetPuppeteer.<anonymous> (/path/to/wechaty-getting-started/node_modules/wechaty-puppet-puppeteer/dist/src/puppet-puppeteer.js:396:36)
    at Generator.next (<anonymous>)
    at /path/to/wechaty-getting-started/node_modules/wechaty-puppet-puppeteer/dist/src/puppet-puppeteer.js:25:71
    at new Promise (<anonymous>)
    at __awaiter (/path/to/wechaty-getting-started/node_modules/wechaty-puppet-puppeteer/dist/src/puppet-puppeteer.js:21:12)
    at PuppetPuppeteer.login (/path/to/wechaty-getting-started/node_modules/wechaty-puppet-puppeteer/dist/src/puppet-puppeteer.js:395:16)
    at PuppetPuppeteer.<anonymous> (/path/to/wechaty-getting-started/node_modules/wechaty-puppet-puppeteer/dist/src/event.js:111:24)
    at Generator.next (<anonymous>)
    at fulfilled (/path/to/wechaty-getting-started/node_modules/wechaty-puppet-puppeteer/dist/src/event.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:29598) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:29598) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Message#Text(👥Room<rm1>🗣Contact<me>)<hello>
Message#Text(👥Room<rm1>🗣Contact<me>)<hello>
22:42:49 WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:[object Object], timeout:60000
22:44:56 WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:inited, timeout:120000
22:47:04 WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:inited, timeout:120000
22:49:11 WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:inited, timeout:120000
22:51:19 WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:inited, timeout:120000
22:53:26 WARN PuppetPuppeteer initWatchdogForPuppet() dog.on(reset) last food:inited, timeout:120000
^C


Moving the Official Wechaty Examples over

Is it a good idea to move the Official Wechaty Examples from https://github.com/Chatie/wechaty/tree/master/examples to here?

Those example, cannot be used out of the box, due to the relative-path importing.
Moving them over here will eliminate one more unnecessary step for new developers/users to try out Wechaty.

At the very least, please move the ding-dong-bot over, and give example in README how to start the ding-dong typescript bot.

And please move hot-import-bot example over as well, as I wasn't even able to make it run -- wechaty/wechaty#1222

Thx

An in-range update of wechaty is breaking the build 🚨

Version 0.22.2 of wechaty was just published.

Branch Build failing 🚨
Dependency wechaty
Current Version 0.22.1
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

wechaty is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • continuous-integration/travis-ci/push: The Travis CI build passed (Details).
  • Travis CI - Branch: The build passed.

Commits

The new version differs by 2 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

This hot-reload example will not work on the second bot if it is launched asynchronically

const { Wechaty } = require('wechaty')

function setupBot(id) {
  const bot = new Wechaty({ profile: `memory-cards/${id}` })
  bot
    .on('scan', './on-scan')
    .start()
  return bot
}

setInterval(async () => {
  setupBot(Math.random())
}, 10000)

We are working on launching bot dynamically. However, whenever we are using hot-reload, any bot launched after the first one will fail. This example will work if we are not using hot-reload.

Error:
ERR Wechaty onModulePath(scan, ./on-scan) listener exception: TypeError: Cannot read property 'apply' of undefined

image cannot be send

I run the starter-bot.js, and onMessage as below. However, when I receive a message, "hello" can be send successfully everytime, but the image can not send. I do not understand why

async function onMessage (msg) {
  console.log(msg.toString())
    if (!msg.self()){
        await msg.say('hello')
        const fileBox = FileBox.fromFile('./img/tuzi.png')
        await msg.say(fileBox)
    }
}

mock@latest, TypeError [ERR_INVALID_ARG_TYPE]: The "request" argument must be of type string. Received type undefined

I updated my wechaty environment to the latest today but found that WECHATY_PUPPET=mock is now broken:

Using the latest wechaty-getting-started/examples/starter-bot.js as the example:

$ node starter-bot.js
18:45:33 INFO Wechaty <default> start() v0.22.4 is starting...
Starter Bot Started.

I.e., AOK. Now run with WECHATY_PUPPET=mock:

$ WECHATY_PUPPET=mock node starter-bot.js
18:45:53 INFO Wechaty <mock> start() v0.22.4 is starting...
18:45:53 INFO PuppetManager install(mock@latest) please wait ...
npm: + [email protected]
added 1 package from 2 contributors and audited 1 package in 1.153s

npm: found 0 vulnerabilities

18:45:55 INFO PuppetManager install(mock@latest) done
TypeError [ERR_INVALID_ARG_TYPE]: The "request" argument must be of type string. Received type undefined
    at Function.resolve (internal/modules/cjs/helpers.js:28:13)
    at new mock (/path/to/node_modules/mock/index.js:15:29)
    at Function.<anonymous> (/path/to/node_modules/wechaty/dist/src/puppet-manager.js:58:34)
    at Generator.next (<anonymous>)
    at fulfilled (/path/to/node_modules/wechaty/dist/src/puppet-manager.js:4:58)

$ npm list --depth=0
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

how to hot-import config?

I'm trying to hot-import config:

const { hotImport } = require('hot-import')

async function onMessage (message) {
  const cfg = await hotImport('./config')
  console.log(`Received message: ${message} from ${cfg.db.host}`)
}

It works for the first received message. However on receiving the 2nd message, the program errored out with:

(node:80803) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'db' of undefined
    at Wechaty.onMessage (/path/to/wx/hot-import-bot/on-message.js:25:56)
(node:80803) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

How can I make it works please?

add package.json

after we have a package.json, then we can run npm install to install npm wechaty, which will be required by node mybot.js

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

配置完了token环境变量,运行npm start报错

PS F:\ayzb\we\wechaty-getting-started> npm start

[email protected] start F:\ayzb\we\wechaty-getting-started
node examples/starter-bot.js

14:30:19 INFO Wechaty <wechaty_puppet> start() v0.22.6 is starting...
14:30:19 INFO PuppetManager install(wechaty_puppet@latest) please wait ...
npm: npm
npm: ERR! code E404
npm ERR! 404
npm: Not Found: wechaty_puppet@latest

npm:

npm: npm ERR! A complete log of this run can be found in:
npm ERR! D:\Develop\nodejs\node_cache_logs\2019-02-27T06_30_24_611Z-debug.log

{ Error: Command failed: npm install wechaty_puppet@latest
npm ERR! code E404
npm ERR! 404 Not Found: wechaty_puppet@latest

npm ERR! A complete log of this run can be found in:
npm ERR! D:\Develop\nodejs\node_cache_logs\2019-02-27T06_30_24_611Z-debug.log

at ChildProcess.exithandler (child_process.js:294:12)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.EventEmitter.emit (domain.js:441:20)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

killed: false,
code: 1,
signal: null,
cmd: 'npm install wechaty_puppet@latest ' }
14:30:24 ERR Wechaty start() exception: Command failed: npm install wechaty_puppet@latest
npm ERR! code E404
npm ERR! 404 Not Found: wechaty_puppet@latest

npm ERR! A complete log of this run can be found in:
npm ERR! D:\Develop\nodejs\node_cache_logs\2019-02-27T06_30_24_611Z-debug.log

{ Error: Command failed: npm install wechaty_puppet@latest
npm ERR! code E404
npm ERR! 404 Not Found: wechaty_puppet@latest

npm ERR! A complete log of this run can be found in:
npm ERR! D:\Develop\nodejs\node_cache_logs\2019-02-27T06_30_24_611Z-debug.log

at ChildProcess.exithandler (child_process.js:294:12)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.EventEmitter.emit (domain.js:441:20)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

killed: false,
code: 1,
signal: null,
cmd: 'npm install wechaty_puppet@latest ' }
PS F:\ayzb\we\wechaty-getting-started>

Not working on Ubuntu 16.04.4 LTS

As the document recommended, I purchased a server on Digital Ocean to run this demo. I chose an Ubuntu 16.04.4 LTS image and updated the Node.js version on it; However, something wrong still occurred. I attach the output from my command line here in case someone needs to look it up.
Terminal Saved Output.txt

Api.ai or Dialogflow

When tried to “node examples\professional\api-ai-bot.ts”, got below error. Is it possible wechaty provide js file for api.ai or dialogflow please? Thanks.

wechaty-getting-started-master\examples\professional\api-ai-bot.ts:31
import { Brolog as log } from 'brolog'
^

SyntaxError: Unexpected token {
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:656:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)

Add Image for wechaty

Since install the package seems difficult for newcomers, even for some developers who had developed for a long time. So we decide to add some image for wechaty.

Include folloiwng puppet:

  • wechaty-puppet-padchat
  • wechaty-puppet-puppeteer

Server:

  • aliyun
  • qingyun
  • tencent
  • aws

Before we run the examples, wechaty should be installed.

Wechaty installation is not so easy that it tooks me 4 hours to complete this simple task in Windows 10 Home Edition.

First, there're 2 ways to install wechaty, one is npm, the other is docker. Because docker needs at least Windows Proffesional to run in, we only have the first choice if we bought a home-use Windows and are not going to get the Windows Pro at $99.

Secondly, if we choose install it via npm way, some requirements and descriptions missed in the installation docs:

  1. node, the version needs 10 or above
  2. Python 2.7, node-gyp needs it
  3. Microsoft's windows-build-tools, node-gyp needs it, so Visual Studio Community is a nice choice.
  4. puppeteer, the package is hard to download if we don't use cnpm

If we complete the 4 steps, wechaty runs!

Then, the QRCode in Windows Cmd Prompt is in a mess, I have to copy it from console to notepad and change the font setting to "Lucida Console", font-size 5, CTRL+A to reverse the color of the QRCode.

Finally, after I scaned it, the ding-dong-bot run, I sent a ding, it replied a dong. That was the story yestorday.

add more description to README

should descript:

  1. how to run by node mybot.js by npm install
  2. how to run by docker
  3. other information should be know when a developer a new to Wechaty
  4. etc

npm install fail

⠹ [43/44] Installing node-expat@^2.3.15
WARN node unsupported "[email protected]" is incompatible with [email protected] › joi@^13.1.2, expected node@>=8.9.0
⠸ [43/44] Installing [email protected]
WARN node unsupported "[email protected]" is incompatible with [email protected][email protected][email protected], expected node@>=8.9.0
⠼ [43/44] Installing nan@^2.3.5
WARN node unsupported "[email protected]" is incompatible with [email protected][email protected][email protected], expected node@>=8.0.0
⠸ [43/44] Installing [email protected]: Entering directory `/home/node/node_modules/[email protected]@node-expat/build'
  CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlparse.o
⠼ [43/44] Installing [email protected]../deps/libexpat/lib/xmlparse.c: In function ‘gather_time_entropy’:
../deps/libexpat/lib/xmlparse.c:780:7: warning: variable ‘gettimeofday_res’ set but not used [-Wunused-but-set-variable]
   int gettimeofday_res;
       ^
⠦ [43/44] Installing [email protected]  CC(target) Release/obj.target/expat/deps/libexpat/lib/xmltok.o
⠧ [43/44] Installing [email protected]  CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlrole.o
⠙ [43/44] Installing [email protected]  AR(target) Release/obj.target/deps/libexpat/libexpat.a
  COPY Release/libexpat.a
  CXX(target) Release/obj.target/node_expat/node-expat.o
make: g++: Command not found
make: *** [Release/obj.target/node_expat/node-expat.o] Error 127
make: Leaving directory `/home/node/node_modules/[email protected]@node-expat/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/cnpm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
gyp ERR! System Linux 3.10.0-862.3.3.el7.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/cnpm/node_modules/npminstall/node-gyp-bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/node/node_modules/[email protected]@node-expat
gyp ERR! node -v v6.14.2
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok 
✖ Install fail! Error: Run "sh -c node-gyp rebuild" error, exit code 1
Error: Run "sh -c node-gyp rebuild" error, exit code 1
    at ChildProcess.proc.on.code (/usr/lib/node_modules/cnpm/node_modules/runscript/index.js:74:21)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:920:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)

rename repository name

now it's https://github.com/lijiarui/Getting-Started-with-Wechaty---Live-Coding-Tutorial

should be renamed to https://github.com/lijiarui/wechaty-getting-started

later we can move this repository to /wechaty/wechaty-getting-started

can't invite somebody in to the keyroom

Room.find({topic: "swim"}).then(function(keyroom){
console.log("聯係人:"+who)
console.log(keyroom)
if (keyroom) {
// keyroom.say("welcome!", who)
keyroom.add(who).then(function () {
keyroom.say("welcome!", who)
})
}
})

Actually, I used the code directly here, so it is similar to this code. but it doesn't work on my computer.
it always throw the error: can't find contactId or roomId. But the console shows that the room has been found.
Additionally, I think I didn't use these two parameters at all.
Hope for solution. Thank you.

Issue on sending url link to user

I encountered issue on sending url link to user, here are my code and error log:

/local wechaty version: [email protected]/

async function onMessage(msg) {
......

const LinkPayload = {
        description: '评级:'+body.a.others[0].distance.toString()+',来源:'+body.a.others[0].source,
        thumbnailUrl: 'http://www.haola.com/images/haola.png',
        title : body.a.others[0].title,
        url   : body.a.others[0].url
      }
      msg.say(LinkPayload)

----------------------------------------------------------
report error:
(node:32318) UnhandledPromiseRejectionWarning: Error: unknown msg: [object Object]
    at AnotherOriginalClass.<anonymous> (/root/node_modules/wechaty/dist/src/user/message.js:392:23)
    at Generator.next (<anonymous>)
    at /root/node_modules/wechaty/dist/src/user/message.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/root/node_modules/wechaty/dist/src/user/message.js:3:12)
    at AnotherOriginalClass.say (/root/node_modules/wechaty/dist/src/user/message.js:348:16)
    at Request._callback (/root/tuling.js:117:11)
    at Request.self.callback (/root/node_modules/request/request.js:185:22)
    at Request.emit (events.js:182:13)
    at Request.EventEmitter.emit (domain.js:442:20)
    at Request.<anonymous> (/root/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:182:13)
    at Request.EventEmitter.emit (domain.js:442:20)
    at IncomingMessage.<anonymous> (/root/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:273:13)
    at IncomingMessage.emit (events.js:187:15)
    at IncomingMessage.EventEmitter.emit (domain.js:442:20)
    at endReadableNT (_stream_readable.js:1085:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:32318) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:32318) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Could you help me to check and give some guidance on how to fix this issue? Thanks in advance.

Thanks in advance,
Jackie

npm install fail

Can we install with an mirror url?

MacBook-Pro:wechaty-getting-started wang$ npm install
(node:57492) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

> [email protected] install /Users/wang/IdeaProjects/wechaty-getting-started/node_modules/chromedriver
> node install.js

Downloading https://chromedriver.storage.googleapis.com/2.29/chromedriver_mac64.zip
Saving to /var/folders/_l/b4wgtxhd7f95181gp7ks91100000gn/T/chromedriver/chromedriver_mac64.zip
npm ERR! Darwin 17.2.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.11.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the chromedriver package,
npm ERR! not with npm itself.

media-file-bot save file to local not work

Hi,
I clone Chatie/wechaty-getting-started and Chatie/wechaty, run the media-file-bot example with two projects, but when I send a pdf file to the robot,file save not be trigger msg.type() !== bot.Message.Type.Text will be return false, only return something like this RECV: Message#Text(🗣Contact<张硕>👤Contact<WonderCV小助手>)<&lt;msg&gt;&lt;appmsg appid="" sdkver="0"&gt;&lt;title&gt;xxx.pdf&lt;/>.

I also clone lijiarui/wechaty-puppet-padchat add the code to examples/wechaty-padchat-bot onMessage function

  if (msg.type() !== Message.Type.Text) {
    const file = await msg.toFileBox()
    const name = file.name
     console.log('Save file to: ' + name)
     file.toFile(name)
  }

I try again that console throw unsupport type: StatusNotify(51) because it is not fully implemented yet

Does this mean that the feature is not yet supported? , or is there a problem with the version I am running? Three projects are cloned master branch.
I look forward to your answer. thank you .

Bot does not send message to itself (only in console)

Hello,

I'm setting up this bot to extract content (image and video) from wechat. This content is only sent by myself (no other contact).
I have set up wechaty with my own wechat account, so basically I'm talking to myself.

So far it's working: I can send media to myself (on my phone) and wechaty bot will capture and save them on my server.
However, when I want the bot to reply a message, it does not appear on the phone, but I can see the reply in the console.

see the console extract below:
RECV: Message#Image(🗣Contact<Cyril>👤Contact<Cyril>)
Save file to: /media/3139708290439575100.jpg
RECV: Message#Text(🗣Contact<Cyril>👤Contact<Cyril>)<Thank you>

I cannot see the reply "Thank you" on my phone
How should i proceed ?

Thank you

npm install goes error

node version - 10.6.0
platform - win10

I follow the instructions to get start.
when I "npm config set registry https://github.com/Chatie/wechaty/wiki/NPM#use-npm-in-china" and run 'npm install' . I got a lot of errors.I put those errors at the end of this issues.
so I do 'npm config set registry https://registry.npm.taobao.org' and run 'npm install' ,everything gose right

I do not know why, someone help me ?

Below is the error detail
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 63d543a1f2b947a9
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall [email protected]
7 info lifecycle [email protected]~preinstall: [email protected]
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 timing stage:loadCurrentTree Completed in 16ms
11 silly install loadIdealTree
12 silly install cloneCurrentTreeToIdealTree
13 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
14 silly install loadShrinkwrap
15 timing stage:loadIdealTree:loadShrinkwrap Completed in 4ms
16 silly install loadAllDepsIntoIdealTree
17 http fetch GET 200 https://github.com/Chatie/wechaty/wiki/qrcode-terminal 3791ms
18 silly fetchPackageMetaData error for qrcode-terminal@^0.12.0 Unexpected token < in JSON at position 6 while parsing near '
18 silly fetchPackageMetaData
18 silly fetchPackageMetaData
18 silly fetchPackageMetaData
18 silly fetchPackageMetaData
18 silly fetchPackageMetaData
18 silly fetchPackageMetaData
18 silly fetchPackageMetaData <htm...'
19 http fetch GET 200 https://github.com/Chatie/wechaty/wiki/wechaty 3943ms
20 silly fetchPackageMetaData error for wechaty@^0.19.1 Unexpected token < in JSON at position 6 while parsing near '
20 silly fetchPackageMetaData
20 silly fetchPackageMetaData
20 silly fetchPackageMetaData
20 silly fetchPackageMetaData
20 silly fetchPackageMetaData
20 silly fetchPackageMetaData
20 silly fetchPackageMetaData <htm...'
21 http fetch GET 200 https://github.com/Chatie/wechaty/wiki/qrcode-terminal 2023ms
22 silly fetchPackageMetaData error for qrcode-terminal@^0.12.0 Unexpected token < in JSON at position 6 while parsing near '
22 silly fetchPackageMetaData
22 silly fetchPackageMetaData
22 silly fetchPackageMetaData
22 silly fetchPackageMetaData
22 silly fetchPackageMetaData
22 silly fetchPackageMetaData
22 silly fetchPackageMetaData <htm...'
23 http fetch GET 200 https://github.com/Chatie/wechaty/wiki/wechaty 2728ms
24 silly fetchPackageMetaData error for wechaty@^0.19.1 Unexpected token < in JSON at position 6 while parsing near '
24 silly fetchPackageMetaData
24 silly fetchPackageMetaData
24 silly fetchPackageMetaData
24 silly fetchPackageMetaData
24 silly fetchPackageMetaData
24 silly fetchPackageMetaData
24 silly fetchPackageMetaData <htm...'
25 timing stage:rollbackFailedOptional Completed in 0ms
26 timing stage:runTopLevelLifecycles Completed in 7238ms
27 silly saveTree [email protected]
28 verbose stack SyntaxError: Unexpected token < in JSON at position 6 while parsing near '
28 verbose stack
28 verbose stack
28 verbose stack
28 verbose stack
28 verbose stack
28 verbose stack
28 verbose stack <htm...'
28 verbose stack at JSON.parse ()
28 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
28 verbose stack at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
28 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
29 verbose cwd C:\work\develop\node\wechaty-getting-started
30 verbose Windows_NT 10.0.17134
31 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
32 verbose node v10.6.0
33 verbose npm v6.1.0
34 error Unexpected token < in JSON at position 6 while parsing near '
34 error
34 error
34 error
34 error
34 error
34 error
34 error <htm...'
35 verbose exit [ 1, true ]

use "wechaty-puppet-padchat" cannot login successfully

I clone the "wechaty-getting-started", and modify the init code of Wechaty in "examples/starter-bot.js". Then in the console, I run "npm install" and "npm start". However, after I scan the qrcode, I got nothing in the console. After a while, I got status -106. And I found issue #176, and it mentions "puppet-padchat-patch" can solve the -106 issue. "puppet-padchat-patch" can show me a new qrcode, but I cannot login after I scan the new qrcode.

My codes as below.

const { Wechaty } = require('wechaty')
const { PadchatPatch } = require('puppet-padchat-patch')

const TOKEN = 'myToken'; // the token I applied
const initialName = 'test';

const puppet = 'wechaty-puppet-padchat'
const puppetOptions = {
    token: TOKEN
}

const bot = new Wechaty({
    initialName,
    puppet,
    puppetOptions,
});
bot.on('scan',    onScan)
bot.on('login',   onLogin)
bot.on('logout',  onLogout)
bot.on('message', onMessage)
bot.start()
.then(() => console.log('Starter Bot Started.'))
.catch(e => console.error(e))

function onScan (qrcode, status) {
  const qrcodeImageUrl = [
    'https://api.qrserver.com/v1/create-qr-code/?data=',
    encodeURIComponent(qrcode),
  ].join('')
  console.log(qrcodeImageUrl)
}

function onLogin (user) {
  console.log(`${user} login`)
}

function onLogout(user) {
  console.log(`${user} logout`)
}

async function onMessage (msg) {
  console.log(msg.toString())
}

/**
 * Hook the -106 failure status here, try to get auth data from separate server
 */
process.on('unhandledRejection', (error) => {
    const { message } = error
    if (message && message.indexOf('unknown status: -106') !== -1) {
        const wxid = message.split(' ').slice(-1)[0]
        const padchatPatch = new PadchatPatch(TOKEN, initialName, wxid)
        padchatPatch
            .on('scan', (qrcode, status) => {
                // You need to let the user scan the qrcode again here
                // generate(qrcode, { small: true })
                const qrcodeImageUrl = [
                    'https://api.qrserver.com/v1/create-qr-code/?data=',
                    encodeURIComponent(qrcode),
                ].join('')
                console.log(`[${status}] ${qrcodeImageUrl}\nScan QR Code above to log in: `)
            })
            .on('finish', async () => {
                // restart your application here
                bot.start()
            })
            .start()
        return
    }
})

TypeError: _asyncToGenerator is not a function

I encountered a issue when using the example file of tuling123-bot.js to process onMessage event

No matter what messages had been sent to robot, it reported same error:

02:42:17 ERR Wechaty onFunction(message) listener exception: TypeError: _asyncToGenerator is not a function
TypeError: _asyncToGenerator is not a function
at Wechaty._onMessage (/bot/tuling.js:53:16)
at Wechaty.onMessage (/bot/tuling.js:49:21)
at Wechaty.on.args (/wechaty/src/wechaty.ts:538:18)
at Wechaty.emit (events.js:182:13)
at Wechaty.EventEmitter.emit (domain.js:442:20)
at Wechaty.emit (/wechaty/src/wechaty.ts:304:18)
at Wechaty. (/wechaty/src/wechaty.ts:646:18)
at Generator.next ()
at fulfilled (/wechaty/dist/src/wechaty.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)

Who can help me to take a look? Is it related to Babel? Thanks in advance.

请问wechaty有详细的api文档吗?

你好,官方给出的文档翻了好几遍也没找到更加详细的api介绍,很多方法都没有放在文档上的样子。
不知是否有更加详细的文档?

Some tips to make basic wechaty more clear

  • Still too hard to understand how to run wechaty, especially on windows.
    • Add What's puppet, list all puppet and give the related link
    • Add wechaty tutorials #17
    • Change starter-bot.ts, add the basic receive and send message functions in the code.
  • Add wiki part on wechaty-puppet-padchat
    • Why we charge for the project
      • No open-source means all can use
      • Server has pressure
    • What the token means
    • How to buy token/private deployment
  • JSdoc API enhancement, which belongs to web API, which belongs to padchat API, which belongs to ioscat API

Warning at first run

I'm trying for the first time this project. Great idea and great work !

I cloned, installed npm packages, and simply run it

I got

$ node mybot.js
14:44:07 WARN Wechaty init() DEPRECATED and will be removed after Jun 2018. Use start() instead.
14:44:07 INFO Wechaty v0.13.93 starting...
(node:8072) UnhandledPromiseRejectionWarning: TypeError: rxjs.interval is not a function
    at ThrottleSubscriber.durationSelector (D:\wechaty-getting-started\node_modules\rx-queue\bundles\rx-queue.umd.js:181:99)
    at ThrottleSubscriber.tryDurationSelector (D:\wechaty-getting-started\node_modules\rxjs\operators\throttle.js:107:25)
    at ThrottleSubscriber._next (D:\wechaty-getting-started\node_modules\rxjs\operators\throttle.js:92:33)
    at ThrottleSubscriber.Subscriber.next (D:\wechaty-getting-started\node_modules\rxjs\Subscriber.js:93:18)
    at Subject.next (D:\wechaty-getting-started\node_modules\rxjs\Subject.js:55:25)
    at ThrottleQueue.next (D:\wechaty-getting-started\node_modules\rx-queue\bundles\rx-queue.umd.js:185:26)
    at PuppetWeb.on.data (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet-web\puppet-web.js:74:60)
    at PuppetWeb.emit (events.js:187:15)
    at PuppetWeb.EventEmitter.emit (domain.js:442:20)
    at PuppetWeb.emit (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet.js:34:22)
    at Watchdog.dog.on.food (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet-web\puppet-web.js:102:20)
    at Watchdog.emit (events.js:182:13)
    at Watchdog.EventEmitter.emit (domain.js:442:20)
    at Watchdog.feed (D:\wechaty-getting-started\node_modules\watchdog\bundles\watchdog.umd.js:188:18)
    at PuppetWeb.puppet.on.food (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet-web\puppet-web.js:98:43)
    at PuppetWeb.emit (events.js:182:13)
    at PuppetWeb.EventEmitter.emit (domain.js:442:20)
    at PuppetWeb.emit (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet.js:34:22)
    at PuppetWeb.<anonymous> (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet-web\event.js:53:14)
    at Generator.next (<anonymous>)
    at fulfilled (D:\wechaty-getting-started\node_modules\wechaty\dist\src\puppet-web\event.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:8072) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside o
f an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8072) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections tha
t are not handled will terminate the Node.js process with a non-zero exit code.

Automatic re-login gone?

I was able to resume login without scanning the qrcode again during my previous testings, even without specifying a profile, which "will generate a file called wechatyName.memory-card.json. This file stores the bot’s login information. If the file is valid, the bot can auto login so you don’t need to scan the qrcode to login again. " according to the API Doc.

but now it seems not working anymore -- I always have to scan the qrcode to login again.

Tried with the default starter-bot.js and the hot-import-bot.js (https://github.com/wechaty/wechaty-getting-started/tree/master/examples/professional/hot-import-bot), and both are the same.

Hope the two files can be corrected to show how the automatic re-login can be done.
Thx.

turning123 APIkey

使用自己申请的turning API始终报 “请按规定的要求进行加密”,请问下是否要怎么处理他们官网出来的APIkey?
看过turning123的文档,但是没有得到一点信息,他们写的太简单了

Run failed ! what's the reason ?

$ npm start

[email protected] start D:\Node\wechaty-getting-started
node examples/starter-bot.js

14:52:48 INFO Wechaty start() v0.18.5 is starting...
14:52:48 INFO Wechaty initPuppet() using puppet: default
14:52:48 WARN MemoryCard sub() DEPRECATED, use multiplex() instead
14:52:48 INFO PuppetConfig installPuppet(wechaty-puppet-puppeteer@^0.4.2) please wait ...
npm:

[email protected] install D:\Node\wechaty-getting-started\node_modules\wechaty\node_modules\node-expat
node-gyp rebuild

npm:
D:\Node\wechaty-getting-started\node_modules\wechaty\node_modules\node-expat>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild
npm: )

npm: gyp
npm: ERR! configure error

npm: gyp ERR! stack
npm: Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)

npm: gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack
npm: at FSReqWrap.oncomplete (fs.js:158:21)

npm: gyp ERR! System Windows_NT 10.0.17134

npm: gyp
npm: 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!
npm: cwd D:\Node\wechaty-getting-started\node_modules\wechaty\node_modules\node-expat
gyp ERR!
npm: node -v v10.7.0
gyp ERR!
npm: node-gyp -v v3.6.2
gyp ERR!
npm: not ok

npm: npm WARN
npm: [email protected] requires a peer of brolog@^1.6.5 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of file-box@^0.8.22 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of hot-import@^0.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN
npm: [email protected] requires a peer of lru-cache@^4.1.3 but none is installed. You must install peer dependencies yourself.

npm: npm
npm: WARN [email protected] requires a peer of qr-image@^3.2.0 but none is installed. You must install peer dependencies yourself.
npm
npm: WARN [email protected] requires a peer of promise-retry@^1.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN
npm: [email protected] requires a peer of rxjs@^6.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN
npm: [email protected] requires a peer of rx-queue@^0.4.26 but none is installed. You must install peer dependencies yourself.
npm WARN
npm: [email protected] requires a peer of state-switch@^0.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of watchdog@^0.8.10 but none is installed. You must install peer dependencies yourself.

npm: npm WARN [email protected] requires a peer of wechaty-puppet@^0.6.4 but none is installed. You must install peer dependencies yourself.

npm:

npm: npm ERR! code
npm: ELIFECYCLE

npm: npm ERR! errno 1

npm: npm ERR!
npm: [email protected] install: node-gyp rebuild
npm ERR! Exit status 1

npm: npm ERR!
npm ERR!
npm: 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:

npm: npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-08-02T06_52_53_079Z-debug.log

14:52:53 ERR PupptConfig puppetResolver(default) install fail: Command failed: npm install wechaty-puppet-puppeteer@^0.4.2
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 10.0.17134
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 D:\Node\wechaty-getting-started\node_modules\wechaty\node_modules\node-expat
gyp ERR! node -v v10.7.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of brolog@^1.6.5 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of file-box@^0.8.22 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of hot-import@^0.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of lru-cache@^4.1.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of qr-image@^3.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of promise-retry@^1.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rxjs@^6.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rx-queue@^0.4.26 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of state-switch@^0.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of watchdog@^0.8.10 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of wechaty-puppet@^0.6.4 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
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! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-08-02T06_52_53_079Z-debug.log

{ Error: Command failed: npm install wechaty-puppet-puppeteer@^0.4.2
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 10.0.17134
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 D:\Node\wechaty-getting-started\node_modules\wechaty\node_modules\node-expat
gyp ERR! node -v v10.7.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of brolog@^1.6.5 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of file-box@^0.8.22 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of hot-import@^0.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of lru-cache@^4.1.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of qr-image@^3.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of promise-retry@^1.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rxjs@^6.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rx-queue@^0.4.26 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of state-switch@^0.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of watchdog@^0.8.10 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of wechaty-puppet@^0.6.4 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
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! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-08-02T06_52_53_079Z-debug.log

at ChildProcess.exithandler (child_process.js:291:12)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.EventEmitter.emit (domain.js:442:20)
at maybeClose (internal/child_process.js:961:16)
at Socket.stream.socket.on (internal/child_process.js:380:11)
at Socket.emit (events.js:182:13)
at Socket.EventEmitter.emit (domain.js:442:20)
at Pipe._handle.close (net.js:599:12)

killed: false,
code: 1,
signal: null,
cmd: 'npm install wechaty-puppet-puppeteer@^0.4.2 ' }
14:52:53 ERR Wechaty start() exception: Command failed: npm install wechaty-puppet-puppeteer@^0.4.2
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 10.0.17134
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 D:\Node\wechaty-getting-started\node_modules\wechaty\node_modules\node-expat
gyp ERR! node -v v10.7.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of brolog@^1.6.5 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of file-box@^0.8.22 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of hot-import@^0.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of lru-cache@^4.1.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of qr-image@^3.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of promise-retry@^1.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rxjs@^6.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rx-queue@^0.4.26 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of state-switch@^0.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of watchdog@^0.8.10 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of wechaty-puppet@^0.6.4 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
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! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-08-02T06_52_53_079Z-debug.log

{ Error: Command failed: npm install wechaty-puppet-puppeteer@^0.4.2
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 10.0.17134
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 D:\Node\wechaty-getting-started\node_modules\wechaty\node_modules\node-expat
gyp ERR! node -v v10.7.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of brolog@^1.6.5 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of file-box@^0.8.22 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of hot-import@^0.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of lru-cache@^4.1.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of qr-image@^3.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of promise-retry@^1.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rxjs@^6.2.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rx-queue@^0.4.26 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of state-switch@^0.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of watchdog@^0.8.10 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of wechaty-puppet@^0.6.4 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
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! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-08-02T06_52_53_079Z-debug.log

at ChildProcess.exithandler (child_process.js:291:12)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.EventEmitter.emit (domain.js:442:20)
at maybeClose (internal/child_process.js:961:16)
at Socket.stream.socket.on (internal/child_process.js:380:11)
at Socket.emit (events.js:182:13)
at Socket.EventEmitter.emit (domain.js:442:20)
at Pipe._handle.close (net.js:599:12)

killed: false,
code: 1,
signal: null,
cmd: 'npm install wechaty-puppet-puppeteer@^0.4.2 ' }

One page wechaty introduction

Wechaty changes a lot these days and maybe we should make a clear tutorial, one-page introduction and API doc these days, both support Chinese and English.

Thanks to #19 (comment) pointing that the docs and tutorial make developer feel confusing and all his experience.

I write related todo list on scratch:

First Priority

  • Wechaty-getting-started
    • What wechaty do, what the project is trying to fix the problem.
    • How to run the project, warning that for new accounts it may not works.
    • Chinese version
    • English version
  • Example code
    - [ ] ding-dong-bot
    - [ ] room-bot
    • contact-bot
    • media-file-bot
    • starter-bot
    • tuling123-bot
    • vedio-demo
  • wechaty API doc
  • FAQ
    • Why puppeteer is no more working for new accounts
    • How to test the new version of wechaty
    • What to do for new accounts

Seconde Priority

  • one-page introduction
    • getting-started
    • tutorial
    • blog
  • Blog
  • Related practice from other developers & blog
  • What is the best practice about the project
  • Blog template
  • Author stories: About the project background
  • Best practice
    • How to migrate from puppeteer(0.14) to padchat(0.18)

This Two part should move to wechaty repo instead of in wechaty-getting started.

  • Explanation of related concepts, including puppet, puppeteer, padchat, etc
    • Puppet System
    • Wechaty-puppet-padchat
    • Wechaty-puppet-puppeteer
    • hostie
    • giftie
    • botie
  • Wechaty Introduction
    • How the whole project works

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.