amiruldev20 / mywajs

wwebjs remake with playwright
https://amiruldev20.github.io/mywajs/
Apache License 2.0
68 stars 50 forks source link

[ERROR] > npm i wwebjs@https://github.com/amiruldev20/mywajs #4

Closed officialdittaz closed 1 year ago

officialdittaz commented 1 year ago

npm ERR! code 1 npm ERR! git dep preparation failed npm ERR! command /nix/store/bwxril521b35zlf4x2g32hll64rzfhck-nodejs-16.7.0/bin/node /nix/store/bwxril521b35zlf4x2g32hll64rzfhck-nodejs-16.7.0/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/home/runner/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run npm ERR! npm WARN using --force Recommended protections disabled. npm ERR! npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. npm ERR! npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm ERR! npm ERR! code 1 npm ERR! npm ERR! path /home/runner/.npm/_cacache/tmp/git-clone-74629057/node_modules/playwright npm ERR! npm ERR! command failed npm ERR! npm ERR! command sh -c node install.js npm ERR! npm ERR! Removing unused browser at /home/runner/.cache/ms-playwright/webkit-1811 npm ERR! npm ERR! Downloading Webkit 16.4 (playwright build v1811) from https://playwright.azureedge.net/builds/webkit/1811/webkit-ubuntu-20.04.zip npm ERR! npm ERR! | | 0% of 91.8 Mb npm ERR! npm ERR! |■■■■■■■■ | 10% of 91.8 Mb npm ERR! npm ERR! |■■■■■■■■■■■■■■■■ | 20% of 91.8 Mb npm ERR! npm ERR! |■■■■■■■■■■■■■■■■■■■■■■■■ | 30% of 91.8 Mb npm ERR! npm ERR! |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 40% of 91.8 Mb npm ERR! npm ERR! |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 50% of 91.8 Mb npm ERR! npm ERR! |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 60% of 91.8 Mb npm ERR! npm ERR! |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 70% of 91.8 Mb npm ERR! npm ERR! |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 80% of 91.8 Mb npm ERR! npm ERR! |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 90% of 91.8 Mb npm ERR! npm ERR! |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 100% of 91.8 Mb npm ERR! npm ERR! /home/runner/.npm/_cacache/tmp/git-clone-74629057/node_modules/playwright-core/lib/server/registry/index.js:651 npm ERR! npm ERR! throw new Error(Failed to download ${title}, caused by\n${e.stack}); npm ERR! npm ERR! ^ npm ERR! npm ERR! npm ERR! npm ERR! Error: Failed to download Webkit 16.4 (playwright build v1811), caused by npm ERR! npm ERR! Error: Unknown system error -122: Unknown system error -122, write npm ERR! npm ERR! at /home/runner/.npm/_cacache/tmp/git-clone-74629057/node_modules/playwright-core/lib/server/registry/index.js:651:13 npm ERR! npm ERR! at async Registry._downloadExecutable (/home/runner/.npm/_cacache/tmp/git-clone-74629057/node_modules/playwright-core/lib/server/registry/index.js:650:5) npm ERR! npm ERR! at async Registry.install (/home/runner/.npm/_cacache/tmp/git-clone-74629057/node_modules/playwright-core/lib/server/registry/index.js:614:9) npm ERR! npm ERR! at async installBrowsersForNpmInstall (/home/runner/.npm/_cacache/tmp/git-clone-74629057/node_modules/playwright-core/lib/server/registry/index.js:790:3) npm ERR! npm ERR! npm ERR! A complete log of this run can be found in: npm ERR! npm ERR! /home/runner/.npm/_logs/2023-04-24T10_47_47_863Z-debug.log

npm ERR! A complete log of this run can be found in: npm ERR! /home/runner/.npm/_logs/2023-04-24T10_47_50_621Z-debug.log

Kok jadi error ya bwang pas install, Run di replit

akmallxx commented 1 year ago

u can try with yarn

officialdittaz commented 1 year ago

u can try with yarn

and finally i got this

yarn add wwebjs@https://github.com/amiruldev20/mywajs yarn add v1.22.11 info No lockfile found. warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/4] Resolving packages... warning crypto@1.0.1: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in. warning request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 warning request > har-validator@5.1.5: this library is no longer supported warning request > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. warning unofficial-carbon-now@1.0.6: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. warning wwebjs > wjs > link-preview-js > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. [2/4] Fetching packages... warning wjs@1.0.1: The engine "whatsapp-web" appears to be invalid. info fsevents@2.3.2: The platform "linux" is incompatible with this module. info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... [-/4] ⠈ waiting... [-/4] ⠈ waiting... [3/4] ⠁ playwright error /home/runner/Fearless-waweb/node_modules/playwright: Command failed. Exit code: 1 Command: node install.js Arguments: Directory: /home/runner/Fearless-waweb/node_modules/playwright Output: Removing unused browser at /home/runner/.cache/ms-playwright/firefox-1391 Downloading Firefox 111.0 (playwright build v1391) from https://playwright.azureedge.net/builds/firefox/1391/firefox-ubuntu-20.04.zip | | 0% of 78.9 Mb |■■■■■■■■ | 10% of 78.9 Mb |■■■■■■■■■■■■■■■■ | 20% of 78.9 Mb |■■■■■■■■■■■■■■■■■■■■■■■■ | 30% of 78.9 Mb |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 40% of 78.9 Mb |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 50% of 78.9 Mb |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 60% of 78.9 Mb |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 70% of 78.9 Mb |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 80% of 78.9 Mb |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ | 90% of 78.9 Mb |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 100% of 78.9 Mb (node:25853) UnhandledPromiseRejectionWarning: Error: Failed to download Firefox 111.0 (playwright build v1391), caused by Error: Unknown system error -122: Unknown system error -122, write at /home/runner/Fearless-waweb/node_modules/playwright-core/lib/server/registry/index.js:651:13 at async Registry._downloadExecutable (/home/runner/Fearless-waweb/node_modules/playwright-core/lib/server/registry/index.js:650:5) at async Registry.install (/home/runner/Fearless-waweb/node_modules/playwright-core/lib/server/registry/index.js:614:9) at async installBrowsersForNpmInstall (/home/runner/Fearless-waweb/node_modules/playwright-core/lib/server/registry/index.js:790:3) (Use node --trace-warnings ... to show where the warning was created) (node:25853) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:25853) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated.

amiruldev20 commented 1 year ago

tak pindahin ke esm dlu sama playwright

amiruldev20 commented 1 year ago

silahkan update. hapus node_modules dan gnti yg baru

officialdittaz commented 1 year ago

silahkan update. hapus node_modules dan gnti yg baru

udah work bang, tpi jadi gini bwang

My code:

const conn = new Client({ authStrategy: new LocalAuth({ clientId: 'botwaweb', dataPath: './session' }), qrMaxRetries: 3, takeoverOnConflict: false, takeoverTimeoutMs: 3000, bypassCSP: false, userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36', puppeteer: { headless: true, defaultViewport: { width: 800, height: 1288 }, args: [ '--no-sandbox', '--disable-web-security', '--no-first-run', '--no-default-browser-check', '--disable-setuid-sandbox', '--disable-accelerated-2d-canvas', '--disable-session-crashed-bubble', '--start-maximized', '--disable-features=LightMode', '--force-dark-mode'

], ignoreHTTPSErrors: true, executablePath: '/nix/store/x205pbkd5xh5g4iv0g58xjla55has3cx-chromium-108.0.5359.94/bin/chromium-browser' }

});

and the result:

browserType.launchPersistentContext: ╔══════════════════════════════════════════════════════╗ ║ Host system is missing dependencies to run browsers. ║ ║ Missing libraries: ║ ║ libgobject-2.0.so.0 ║ ║ libglib-2.0.so.0 ║ ║ libnss3.so ║ ║ libnssutil3.so ║ ║ libsmime3.so ║ ║ libnspr4.so ║ ║ libatk-1.0.so.0 ║ ║ libatk-bridge-2.0.so.0 ║ ║ libcups.so.2 ║ ║ libgio-2.0.so.0 ║ ║ libdrm.so.2 ║ ║ libdbus-1.so.3 ║ ║ libatspi.so.0 ║ ║ libX11.so.6 ║ ║ libXcomposite.so.1 ║ ║ libXdamage.so.1 ║ ║ libXext.so.6 ║ ║ libXfixes.so.3 ║ ║ libXrandr.so.2 ║ ║ libgbm.so.1 ║ ║ libexpat.so.1 ║ ║ libxcb.so.1 ║ ║ libxkbcommon.so.0 ║ ║ libpango-1.0.so.0 ║ ║ libcairo.so.2 ║ ║ libasound.so.2 ║ ╚══════════════════════════════════════════════════════╝ at async Client.initialize (file:///home/runner/Fearless-waweb/node_modules/wwebjs/src/Client.js:118:23) { name: 'Error' }

amiruldev20 commented 1 year ago
const mywa = new Client({
    authStrategy: new npm.mywajs.LocalAuth(),
    playwright: {
        headless: false,
        devtools: false,
        args: [
            '--aggressive-tab-discard',
            '--disable-accelerated-2d-canvas',
            '--disable-application-cache',
            '--disable-cache',
            '--disable-dev-shm-usage',
            '--disable-gpu',
            '--disable-offline-load-stale-cache',
            '--disable-setuid-sandbox',
            '--disable-setuid-sandbox',
            '--disk-cache-size=0',
            '--ignore-certificate-errors',
            '--no-first-run',
            '--no-sandbox',
            '--no-zygote',
            //'--enable-features=WebContentsForceDark:inversion_method/cielab_based/image_behavior/selective/text_lightness_threshold/150/background_lightness_threshold/205'
        ],
        bypassCSP: true,
    },
    markOnlineAvailable: true,
    qrMaxRetries: 2,
    userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36',
    takeoverTimeoutMs: 'Infinity'
})
officialdittaz commented 1 year ago
const mywa = new Client({
    authStrategy: new npm.mywajs.LocalAuth(),
    playwright: {
        headless: false,
        devtools: false,
        args: [
            '--aggressive-tab-discard',
            '--disable-accelerated-2d-canvas',
            '--disable-application-cache',
            '--disable-cache',
            '--disable-dev-shm-usage',
            '--disable-gpu',
            '--disable-offline-load-stale-cache',
            '--disable-setuid-sandbox',
            '--disable-setuid-sandbox',
            '--disk-cache-size=0',
            '--ignore-certificate-errors',
            '--no-first-run',
            '--no-sandbox',
            '--no-zygote',
            //'--enable-features=WebContentsForceDark:inversion_method/cielab_based/image_behavior/selective/text_lightness_threshold/150/background_lightness_threshold/205'
        ],
        bypassCSP: true,
    },
    markOnlineAvailable: true,
    qrMaxRetries: 2,
    userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36',
    takeoverTimeoutMs: 'Infinity'
})

Thanks bang worked, walau ada beberapa module yg blom ke install tadi seperti

Tapi ada yang kurang dari wjsnya dari sononya keknya, "wjs": "github:vphelipe/wa-js"

My code:

const { Client, Location, List, Buttons, LocalAuth } = (await import("wwebjs"))

const conn = new Client({ authStrategy: new LocalAuth({ clientId: 'botwaweb', dataPath: './session' }), playwright: { headless: false, devtools: false, args: [ '--aggressive-tab-discard', '--disable-accelerated-2d-canvas', '--disable-application-cache', '--disable-cache', '--disable-dev-shm-usage', '--disable-gpu', '--disable-offline-load-stale-cache', '--disable-setuid-sandbox', '--disable-setuid-sandbox', '--disk-cache-size=0', '--ignore-certificate-errors', '--no-first-run', '--no-sandbox', '--no-zygote', //'--enable-features=WebContentsForceDark:inversion_method/cielab_based/image_behavior/selective/text_lightness_threshold/150/background_lightness_threshold/205' ], bypassCSP: true, executablePath:chromiumPath }, markOnlineAvailable: true, qrMaxRetries: 2, userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36', takeoverTimeoutMs: 'Infinity' })

Console: Error: Cannot find module '/home/runner/Fearless-waweb/node_modules/wjs/dist/wppconnect-wa.js' at createEsmNotFoundErr (node:internal/modules/cjs/loader:960:15) at finalizeEsmResolution (node:internal/modules/cjs/loader:953:15) at resolveExports (node:internal/modules/cjs/loader:482:14) at Function.Module._findPath (node:internal/modules/cjs/loader:522:31) at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27) at Function.resolve (node:internal/modules/cjs/helpers:100:19) at Client.initialize (file:///home/runner/Fearless-waweb/node_modules/wwebjs/src/Client.js:144:27) { code: 'MODULE_NOT_FOUND', path: '/home/runner/Fearless-waweb/node_modules/wjs/package.json' }

officialdittaz commented 1 year ago
const mywa = new Client({
    authStrategy: new npm.mywajs.LocalAuth(),
    playwright: {
        headless: false,
        devtools: false,
        args: [
            '--aggressive-tab-discard',
            '--disable-accelerated-2d-canvas',
            '--disable-application-cache',
            '--disable-cache',
            '--disable-dev-shm-usage',
            '--disable-gpu',
            '--disable-offline-load-stale-cache',
            '--disable-setuid-sandbox',
            '--disable-setuid-sandbox',
            '--disk-cache-size=0',
            '--ignore-certificate-errors',
            '--no-first-run',
            '--no-sandbox',
            '--no-zygote',
            //'--enable-features=WebContentsForceDark:inversion_method/cielab_based/image_behavior/selective/text_lightness_threshold/150/background_lightness_threshold/205'
        ],
        bypassCSP: true,
    },
    markOnlineAvailable: true,
    qrMaxRetries: 2,
    userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36',
    takeoverTimeoutMs: 'Infinity'
})

Thanks bang worked, walau ada beberapa module yg blom ke install tadi seperti

  • playwright
  • link-preview-js
  • node-webmux
  • sharp done udah gua install sendiri

Tapi ada yang kurang dari wjsnya dari sononya keknya, "wjs": "github:vphelipe/wa-js"

My code:

const { Client, Location, List, Buttons, LocalAuth } = (await import("wwebjs"))

const conn = new Client({ authStrategy: new LocalAuth({ clientId: 'botwaweb', dataPath: './session' }), playwright: { headless: false, devtools: false, args: [ '--aggressive-tab-discard', '--disable-accelerated-2d-canvas', '--disable-application-cache', '--disable-cache', '--disable-dev-shm-usage', '--disable-gpu', '--disable-offline-load-stale-cache', '--disable-setuid-sandbox', '--disable-setuid-sandbox', '--disk-cache-size=0', '--ignore-certificate-errors', '--no-first-run', '--no-sandbox', '--no-zygote', //'--enable-features=WebContentsForceDark:inversion_method/cielab_based/image_behavior/selective/text_lightness_threshold/150/background_lightness_threshold/205' ], bypassCSP: true, executablePath:chromiumPath }, markOnlineAvailable: true, qrMaxRetries: 2, userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36', takeoverTimeoutMs: 'Infinity' })

Console: Error: Cannot find module '/home/runner/Fearless-waweb/node_modules/wjs/dist/wppconnect-wa.js' at createEsmNotFoundErr (node:internal/modules/cjs/loader:960:15) at finalizeEsmResolution (node:internal/modules/cjs/loader:953:15) at resolveExports (node:internal/modules/cjs/loader:482:14) at Function.Module._findPath (node:internal/modules/cjs/loader:522:31) at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27) at Function.resolve (node:internal/modules/cjs/helpers💯19) at Client.initialize (file:///home/runner/Fearless-waweb/node_modules/wwebjs/src/Client.js:144:27) { code: 'MODULE_NOT_FOUND', path: '/home/runner/Fearless-waweb/node_modules/wjs/package.json' }

Pas gua cek di node_modules ada loh dist/wppconnect.js

officialdittaz commented 1 year ago

Screenshot_2023-04-26-07-44-15-066_com android chrome