search

Home  >  Q&A  >  body text

请问这个git上开源的node项目怎样才能在windows用Npm跑起来

这个项目https://github.com/wechaty/wechaty

以前都是用人家弄好的手脚架搞得es6,搞了2天搞起了es6还报错,错误信息在下面,然后我想请教大神:
1我到底应该怎么弄才能在windows上跑起来,
2还有如果要学Docker,有没有什么好的学习docker的中文教程?
3还有里面都是.ts结尾的是什么鬼?要学会如何用这个应该去学什么东西?在哪里学比较好?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

E:\weixin\wechaty>npm run dev

 

weixinbot@1.0.0 dev E:\weixin\wechaty

babel-node ./src/mybot.js

INFO Wechaty v0.5.0 initializing...

[7588:15908:1105/175418:ERROR:mf_helpers.cc(12)] Error

in dxva_video_decode_accelerator_win.cc on line 345

WARN PuppetWebBrowserDriver getChromeDriver() exception

: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:52667, re

try: 0

WARN PuppetWebBrowserDriver getChromeDriver() with retr

y: 1

E:\weixin\wechaty\node_modules.3.0.0@selenium-webdrive

r\lib\promise.js:2497

throw error;

^

 

Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:5266

7

at ClientRequest. (E:\weixin\wechaty\nod

e_modules.3.0.0@selenium-webdriver\http\index.js:238:1

5)

at emitOne (events.js:96:13)

at ClientRequest.emit (events.js:188:7)

at Socket.socketErrorListener (_http_client.js:306:

9)

at emitOne (events.js:96:13)

at Socket.emit (events.js:188:7)

at emitErrorNT (net.js:1272:8)

at _combinedTickCallback (internal/process/next_tic

k.js:74:11)

at process._tickDomainCallback (internal/process/ne

xt_tick.js:122:9)

From: Task: WebDriver.createSession()

at Function.createSession (E:\weixin\wechaty\node_m

odules.3.0.0@selenium-webdriver\lib\webdriver.js:776:2

4)

at Function.createSession (E:\weixin\wechaty\node_m

odules.3.0.0@selenium-webdriver\chrome.js:709:29)

at createDriver (E:\weixin\wechaty\node_modules.3.

0.0@selenium-webdriver\index.js:167:33)

at Builder.build (E:\weixin\wechaty\node_modules.3

.0.0@selenium-webdriver\index.js:639:16)

at BrowserDriver. (E:\weixin\wechaty\nod

e_modules.0.5.1@wechaty\src\puppet-web\browser-driver.

ts:131:24)

at next (native)

at E:\weixin\wechaty\node_modules.0.5.1@wechaty\di

st\src\puppet-web\browser-driver.js:7:65

at new Promise (E:\weixin\wechaty\node_modules.2.4

.1@core-js\modules\es6.promise.js:191:7)

at __awaiter (E:\weixin\wechaty\node_modules.0.5.1

@wechaty\dist\src\puppet-web\browser-driver.js:3:12)

at BrowserDriver.getChromeDriver (E:\weixin\wechaty

\node_modules.0.5.1@wechaty\dist\src\puppet-web\browse

r-driver.js:65:16)

 

npm ERR! Windows_NT 10.0.14393

npm ERR! argv "E:\Program Files\nodejs\node.exe" "E:

\Program Files\nodejs\node_modules\npm\bin\npm-cl

i.js" "run" "dev"

npm ERR! node v6.2.0

npm ERR! npm v3.8.9

npm ERR! code ELIFECYCLE

npm ERR! weixinbot@1.0.0 dev: babel-node ./src/mybot.j s

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the weixinbot@1.0.0 dev script 'babe

l-node ./src/mybot.js'.

npm ERR! Make sure you have the latest version of node.

js and npm installed.

npm ERR! If you dothis is most likely a problem with

the weixinbot package,

npm ERR! not with npm itself.

npm ERR! Tell the author that this fails on your system

:

npm ERR! babel-node ./src/mybot.js

npm ERR! You can get information on how to open an issu

for this project with:

npm ERR! npm bugs weixinbot

npm ERR! Or if that isn't available, you can get their

info via:

npm ERR! npm owner ls weixinbot

npm ERR! There is likely additional logging output abov

e.

 

npm ERR! Please include the following file with any sup

port request:

npm ERR! E:\weixin\wechaty\npm-debug.log


高洛峰高洛峰3088 days ago982

reply all(1)I'll reply

  • 三叔

    三叔2016-11-07 10:53:35

    题主的这个情况,可以使用 docker 部署 nodejs 项目哦,只不过 windows 上的 docker 还需要一个 docker toolbox (实际上就是 Linux 虚拟机) 然后窝主要来回答一下问题 2

    学 docker 最好的办法还是看官方的文档(官方文档应该只有英文的)和自己尝试啦

    如果是学习 docker 的原理的话,那么建议去看源码,以及 Union Filesystem, Control Group 还有 LXC 等相关的知识

    如果是想学习docker如何使用的话 官方的这个我觉得就可以了 (下面我的回答也是针对 docker 如何使用)

    https://docker.github.io/engi...

    然后这里列出几个我认为比较常用的docker命令+option

    docker run [options] [image-name] [command] 创建并启动一个container,在container内执行command

    1. docker run -it

    其中最常用的一个命令就是

    docker run -it ubuntu:14.04 /bin/bash 这就启动了一个可以交互的 Ubuntu14.04 的 docker 容器,不过当你输入exit退出bash的时候这个容器也会退出,可以改用后台启动容器

    如果想要后台启动这个容器的话 加上 -d(detach) 参数 下面是后台启动这个容器的一个例子

    docker run -d -it ubuntu:14.04 /bin/bash 后台容器运行成功之后你会得到一个容器的ID,也可以使用docker ps不带任何参数能看到当前 running 的所有容器,就能查看到容器ID了

    假设ID为deadbeef

    下面如果想要用这个容器的话 就直接

    docker exec deadbeef [your-command-here]

    如果想要使用上面那样的交互式 bash 则执行

    docker exec -it deadbeef /bin/bash

    这个bash你使用exit退出后,并不会使容器退出=w=

    2. docker run -v

    当想要把本机上的某一个目录挂载到docker中的时候,就需要使用-v参数了 比如想要把本机的 /home/project 挂载到docker的 /var/www/html 下, 执行这个指令即可

    docker run -v "/home/project:/var/www/html" -it bash

    3. docker run -p

    当想要将某些 container 的端口绑定到宿主机上的时候,就使用 -p 参数 下面的例子是将宿主机的1999和container的80端口绑定

    docker run -d -it -p "127.0.0.1:1999:80" ubuntu:14.04 /bin/bash

    然后在 docker 容器内用 netcat 监听80端口 (假设containerID依旧为deadbeef)

    docker exec deadbeef nc -l 80 命令行应该会阻塞住等待相应的请求到来

    在宿主机上用 curl 或者其他的什么工具访问1999端口,这里用curl

    curl 127.0.0.1:1999

    这时刚刚阻塞的 netcat 应该会收到 curl 的请求=w=

    4.docker ps

    这个指令就是用来查看各种状态的容器的,详情看 man page 以及 docker ps --help

    5.docker commit & docker push

    这些指令可以将本地的 container 镜像发布到 docker registry (比如 dockerhub)

    6. 其他的指令题主只要 docker [command] --help 就可以看到很详细的 option 的说明了

    想要使用其他的参数,查看其含义的时候只需要docker run --help就可以看到docker run可以接受的所有参数了


    reply
    0
  • Cancelreply