Code Monkey home page Code Monkey logo

Comments (29)

MaikoTan avatar MaikoTan commented on August 25, 2024

It says you can try the --no-sandbox option. Have you tried?

from koishi-plugin-puppeteer.

vlssu avatar vlssu commented on August 25, 2024

It says you can try the --no-sandbox option. Have you tried?

Tried it, still getting an error.

2022-04-27 18:00:58 [W] ndefined;1mapp Error: Failed to launch the browser process! spawn /chrome-linux/chrome --no-sandbox ENOENT
                        
                        
                        TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
                        
                            at onClose (/koishi4地址/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:241:20)
                            at ChildProcess.<anonymous> (/koishi4地址/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:233:85)
                            at ChildProcess.emit (events.js:400:28)
                            at Process.ChildProcess._handle.onexit (internal/child_process.js:280:12)
                            at onErrorNT (internal/child_process.js:469:16)
                            at processTicksAndRejections (internal/process/task_queues.js:82:21)

from koishi-plugin-puppeteer.

shigma avatar shigma commented on August 25, 2024

提供一下环境信息,包括系统版本,Node 版本和 chromium 版本。

from koishi-plugin-puppeteer.

MaikoTan avatar MaikoTan commented on August 25, 2024

try not to specify the path of chrome executable, just add the option.

Also, check if there is an instance of chromium under node_modules/puppeteer/bin

from koishi-plugin-puppeteer.

vlssu avatar vlssu commented on August 25, 2024

try not to specify the path of chrome executable, just add the option.

Also, check if there is an instance of chromium under node_modules/puppeteer/bin

The error I sent before was not specified, but he still reported an error.

from koishi-plugin-puppeteer.

vlssu avatar vlssu commented on August 25, 2024

提供一下环境信息,包括系统版本,Node 版本和 chromium 版本。

OS: CentOS 7.9.2009 x86_64
Platform: onebot
Node version: v14.19.0
Koishi version: 4.6.1
chromium: 982053
https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/982053/chrome-linux.zip

from koishi-plugin-puppeteer.

MaikoTan avatar MaikoTan commented on August 25, 2024

try not to specify the path of chrome executable, just add the option.

Also, check if there is an instance of chromium under node_modules/puppeteer/bin

The error I sent before was not specified, but he still reported an error.

But the first error indicated you have incoked chrome successfully, just failed to enter the sandbox mode, so --no-sandbox is a potential solution here.

from koishi-plugin-puppeteer.

vlssu avatar vlssu commented on August 25, 2024

try not to specify the path of chrome executable, just add the option.
Also, check if there is an instance of chromium under node_modules/puppeteer/bin

The error I sent before was not specified, but he still reported an error.

But the first error indicated you have incoked chrome successfully, just failed to enter the sandbox mode, so --no-sandbox is a potential solution here.

In the error message I see this Running as root without --no-sandbox is not supported., but not using root will cause the plugin to fail to install in the control panel.

from koishi-plugin-puppeteer.

MaikoTan avatar MaikoTan commented on August 25, 2024

In the error message I see this Running as root without --no-sandbox is not supported., but not using root will cause the plugin to fail to install in the control panel.

That is because you have some permission issue in your current workspace, for example, the folder is created by root and not allow other users to modify files inside it.
Theoretically you should run koishi as non-root user, so you might need to chown and chmod your workspace folders.

from koishi-plugin-puppeteer.

vlssu avatar vlssu commented on August 25, 2024

In the error message I see this Running as root without --no-sandbox is not supported., but not using root will cause the plugin to fail to install in the control panel.

That is because you have some permission issue in your current workspace, for example, the folder is created by root and not allow other users to modify files inside it. Theoretically you should run koishi as non-root user, so you might need to chown and chmod your workspace folders.

image
I've done it again now, and he didn't report an error, but it still didn't work properly.

from koishi-plugin-puppeteer.

MaikoTan avatar MaikoTan commented on August 25, 2024

I think the chess plugin would output text until you type chess --imageMode lol.

from koishi-plugin-puppeteer.

vlssu avatar vlssu commented on August 25, 2024

I think the chess plugin would output text until you type chess --imageMode lol.

image
Is that so? It doesn't seem to work, but I'm fine in koishi3 version.

Ah, it's so uncomfortable. Although I don't use this function for a long time, it is the easiest one I know to check whether it is working properly.

from koishi-plugin-puppeteer.

MaikoTan avatar MaikoTan commented on August 25, 2024

You sure you type the command right? What I see in the image seems like you used a full-width dash (——) instead of half-width hyphens (-).

from koishi-plugin-puppeteer.

shigma avatar shigma commented on August 25, 2024

should be --image-mode

from koishi-plugin-puppeteer.

MaikoTan avatar MaikoTan commented on August 25, 2024

should be --image-mode

Options always are kebab-case même even registered as camelCase in code?

from koishi-plugin-puppeteer.

shigma avatar shigma commented on August 25, 2024

I've beening always writting like this, the command above might work but I'm not sure.

from koishi-plugin-puppeteer.

vlssu avatar vlssu commented on August 25, 2024

C6QGKDYMBUQD19P(}M52P$C
黑白棋 --image-mode
May be caused by the font, it looks like (——)

from koishi-plugin-puppeteer.

MaikoTan avatar MaikoTan commented on August 25, 2024

黑白棋 --image-mode

Is your "黒白棋" a shortcut or an alias? If it is a shortcut, you should register it with prefix and fuzzy, otherwise it would just ignore your arguments.

ctx
  .command("chess")
  .shortcut("黒白棋", { prefix: true, fuzzy: true })
  //                         ^   like this.   ^

from koishi-plugin-puppeteer.

vlssu avatar vlssu commented on August 25, 2024

黑白棋 --image-mode

Is your "黒白棋" a shortcut or an alias? If it is a shortcut, you should register it with prefix and fuzzy, otherwise it would just ignore your arguments.

ctx
  .command("chess")
  .shortcut("黒白棋", { prefix: true, fuzzy: true })
  //                         ^   like this.   ^

"黒白棋" is a chessboard in chess. Direct input of chess --image-mode will not generate a chessboard

from koishi-plugin-puppeteer.

MaikoTan avatar MaikoTan commented on August 25, 2024

https://github.com/koishijs/koishi-plugin-chess/blob/cca17d3f455b02b343e3ef06c753c3bafe5c1a90/src/index.ts#L56

Ah, I see.
So it is a shortcut, I think you should call the chess command instead.

Direct input of chess --image-mode will not generate a chessboard

This is not a command for playing, but for setting the "mode" to the image mode.
Koishi would reply something like "已切换到图片模式。" if you successfully setup puppeteer and chess plugin when you enter this command. If koishi replies something else, that means your puppeteer isn't initialised correctly. You should check out if there is a log that says "app apply plugin puppeteer" without error.

By the way, what is the output if you type "help chess", does it says that there are options "--image-mode" and "--text-mode" in the reply?

from koishi-plugin-puppeteer.

vlssu avatar vlssu commented on August 25, 2024

https://github.com/koishijs/koishi-plugin-chess/blob/cca17d3f455b02b343e3ef06c753c3bafe5c1a90/src/index.ts#L56

Ah, I see. So it is a shortcut, I think you should call the chess command instead.

Direct input of chess --image-mode will not generate a chessboard

This is not a command for playing, but for setting the "mode" to the image mode. Koishi would reply something like "已切换到图片模式。" if you successfully setup puppeteer and chess plugin when you enter this command. If koishi replies something else, that means your puppeteer isn't initialised correctly. You should check out if there is a log that says "app apply plugin puppeteer" without error.

By the way, what is the output if you type "help chess", does it says that there are options "--image-mode" and "--text-mode" in the reply?

2022-04-28 10:37:46 [W] ndefined;1mmarket Error: read ECONNRESET
                            at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20)
2022-04-28 10:37:58 [W] ndefined;1mapp TimeoutError: Timed out after 30000 ms while trying to connect to the browser! Only Chrome at revision r982053 is guaranteed to work.
                            at Timeout.onTimeout (/koishi4/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:252:20)
                            at listOnTimeout (internal/timers.js:557:17)
                            at processTimers (internal/timers.js:500:7)
2022-04-28 10:38:13 [D] ndefined;1mmessage [#] Frank: chess --image-mode

I just saw that there was indeed an error, but it was only displayed when I first entered chess --image-mode.

chess [position]
棋类游戏
输入“五子棋”“黑白棋”“围棋”开始对应的一局游戏。
再输入“落子 A1”将棋子落于 A1 点上。
目前默认使用图片模式。文本模式速度更快,但是在部分机型上可能无法正常显示,同时无法适应过大的棋盘。
可用的选项有:
    --rule <rule>  设置规则,支持的规则有 go, gomoku, othello
    --size <size>  设置大小
    --skip  跳过回合
    --repent  悔棋
    -v, --show, --view  显示棋盘
    -e, --stop, --end  停止游戏
2022-04-28 10:37:58 [W] ndefined;1mapp TimeoutError: Timed out after 30000 ms while trying to connect to the browser! Only Chrome at revision r982053 is guaranteed to work.
                            at Timeout.onTimeout (/koishi4/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:252:20)
                            at listOnTimeout (internal/timers.js:557:17)
                            at processTimers (internal/timers.js:500:7)

from koishi-plugin-puppeteer.

MaikoTan avatar MaikoTan commented on August 25, 2024

So now what is the situation? You choose the chrome that you downloaded or the one bundled in puppeteer?

What I saw is that puppeteer didn't successfully connect to chrome.

from koishi-plugin-puppeteer.

vlssu avatar vlssu commented on August 25, 2024

So now what is the situation? You choose the chrome that you downloaded or the one bundled in puppeteer?

What I saw is that puppeteer didn't successfully connect to chrome.

What I posted just now was bundled with puppeteer, and now this is my own.

2022-04-28 10:45:14 [I] ndefined;1mapp reload plugin ndefinedmpuppeteer
2022-04-28 10:45:14 [W] ndefined;1mapp Error: Failed to launch the browser process! spawn /www/chrome-linux/chrome --no-sandbox ENOENT
                        
                        
                        TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
                        
                            at onClose (/koishi4/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:241:20)
                            at ChildProcess.<anonymous> (/koishi4/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:233:85)
                            at ChildProcess.emit (events.js:400:28)
                            at Process.ChildProcess._handle.onexit (internal/child_process.js:280:12)
                            at onErrorNT (internal/child_process.js:469:16)
                            at processTicksAndRejections (internal/process/task_queues.js:82:21)

from koishi-plugin-puppeteer.

MaikoTan avatar MaikoTan commented on August 25, 2024

Looks like that is a common issue on CentOS 7, what I using is Ubuntu and Debian so I have no many painful experiences while installing the puppeteer.

Try check out:
puppeteer/puppeteer#560

puppeteer/puppeteer#2857

from koishi-plugin-puppeteer.

vlssu avatar vlssu commented on August 25, 2024

docker中运行依旧会出现这个问题。

from koishi-plugin-puppeteer.

MaikoTan avatar MaikoTan commented on August 25, 2024

docker中运行依旧会出现这个问题。

what do you mean by "这个问题" ?

Also, just FYI, it would be better to install google-chrome-stable via package manager like apt in docker container before starting puppeteer with option path point to the path of the chrome that you installed. De plus, the environment variables PUPPETEER_SKIP_CHROMIUM_DOWNLOAD should be set to true while installing puppeteer to prevent downloading the chromium built-in.

EDIT: There are official trouble shooting steps on their website, try to see yourself here.
Au fait, it is not recommanded to run alpine image with puppeteer, which is trouble-ish many times.
https://pptr.dev/troubleshooting/#running-puppeteer-in-docker

from koishi-plugin-puppeteer.

purerosefallen avatar purerosefallen commented on August 25, 2024

@vissu Are you using the puppeteer-specific docker image? You may try that one.

from koishi-plugin-puppeteer.

Anillc avatar Anillc commented on August 25, 2024

测试了一下,使用 koishi 官方的 latest-puppeteer docker 镜像并安装 puppeteer 插件及 chess 插件是可以正常运行并渲染图片的,请检查一下您的运行环境

image

from koishi-plugin-puppeteer.

vlssu avatar vlssu commented on August 25, 2024

通过官方的 koishijs/koishi docker镜像搭建koishi后,基本上没有出现完全不能正常工作的问题了,但有一点不知道是我的问题还是插件本身。
在每次重启 koishi 的docker容器后,puppeteer并没有正常工作,需要手动禁用该插件并重新启用后才能正常工作。

from koishi-plugin-puppeteer.

Related Issues (20)

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.