Baileys
Baileys copied to clipboard
NPM
Can Anyone Upload This Modules In Npmjs.com
I Tried But Its Giving Error Of tsc and typedoc
I have not had a problem generating the package. Be careful, I do not rule out that it is not like that, I am new
https://github.com/WhiskeySockets/Baileys/blob/master/.github/workflows/publish-release.yml
I have not had a problem generating the package. Be careful, I do not rule out that it is not like that, I am new
https://github.com/WhiskeySockets/Baileys/blob/master/.github/workflows/publish-release.yml
![]()
Can i publish in my npm
I have not had a problem generating the package. Be careful, I do not rule out that it is not like that, I am new
https://github.com/WhiskeySockets/Baileys/blob/master/.github/workflows/publish-release.yml
![]()
how can i publish @adiwajshing/[email protected] in my npm after i clone from npm of @adiwajshin/[email protected]
you don't need to use the npmjs.com package you can use yarn add github:WhiskeySockets/Baileys instead while the release is being fixed
you don't need to use the npmjs.com package you can use yarn add github:WhiskeySockets/Baileys instead while the release is being fixed
but i want a single auth one system so i ask to you
The truth is that I have not understood very well, when you say single auth
I used to use this module via require()
but it no longer works
i gives me this error
Cannot find module '...\node_modules\@adiwajshing\baileys\lib\index.js'
I used to use this module via require() but it no longer works i gives me this error
Cannot find module '...\node_modules\@adiwajshing\baileys\lib\index.js'
share screenshot of your package.json
you don't need to use the npmjs.com package you can use yarn add github:WhiskeySockets/Baileys instead while the release is being fixed
but i want a single auth one system so i ask to you
but i want so how can i upload 4.4.0 in my npm
I used to use this module via require() but it no longer works i gives me this error
Cannot find module '...\node_modules\@adiwajshing\baileys\lib\index.js'
share screenshot of your package.json
I'm trying to have Electron load the WhatsApp Web UI directly and use Baileys to connect to the same WebSocket.
preload.js:
const { contextBridge, ipcRenderer, webFrame } = require('electron');
const { WAConnection } = require('@adiwajshing/baileys');
const fs = require('fs');
contextBridge.exposeInMainWorld('electron', {
interceptWebSocket: () => {
ipcRenderer.send('intercept-websocket');
},
});
ipcRenderer.on('intercept-websocket', async () => {
const interceptWebSocket = `
const originalWebSocket = WebSocket;
WebSocket = function (...args) {
const ws = new originalWebSocket(...args);
if (args[0].includes('wss://web.whatsapp.com/ws')) {
window.electron.interceptWebSocket(args[0]);
}
return ws;
};
WebSocket.prototype = originalWebSocket.prototype;
`;
ipcRenderer.send('execute-script', interceptWebSocket);
});
ipcRenderer.on('execute-script', (event, script) => {
webFrame.executeJavaScript(script);
});
ipcRenderer.on('intercept-websocket', async (event, webSocketUrl) => {
const conn = new WAConnection();
conn.logger.level = 'warn';
conn.autoReconnect = true;
conn.connectOptions.timeoutMs = 60 * 1000;
conn.on('connecting', () => {
console.log('Connecting to WhatsApp...');
});
conn.on('open', () => {
console.log('Connected to WhatsApp');
fs.writeFileSync('./auth_info.json', JSON.stringify(conn.base64EncodedAuthInfo(), null, 2));
});
conn.on('close', ({ reason, isReconnecting }) => {
console.log('Disconnected from WhatsApp:', reason, 'Reconnecting:', isReconnecting);
});
conn.on('message-new', (message) => {
const sender = message.key.remoteJid;
const text = message.message?.conversation || message.message?.extendedTextMessage?.text;
if (text) {
console.log(`New message from ${sender}: ${text}`);
}
});
try {
if (fs.existsSync('./auth_info.json')) {
const authInfo = JSON.parse(fs.readFileSync('./auth_info.json', 'utf-8'));
conn.loadAuthInfo(authInfo);
}
await conn.connect();
} catch (error) {
console.error('Error connecting to WhatsApp:', error);
}
});
Error:
Error: Cannot find module '/home/user/dev/wa-desktop/node_modules/@adiwajshing/baileys/lib/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:416:19)
at Module._findPath (node:internal/modules/cjs/loader:658:18)
at Module._resolveFilename (node:internal/modules/cjs/loader:1040:27)
at o._resolveFilename (node:electron/js2c/renderer_init:2:3879)
at Module._load (node:internal/modules/cjs/loader:900:27)
at f._load (node:electron/js2c/asar_bundle:2:13330)
at o._load (node:electron/js2c/renderer_init:2:3109)
at Module.require (node:internal/modules/cjs/loader:1120:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/home/user/dev/wa-desktop/app/view_preload.js:3:26)
(```
I used to use this module via require() but it no longer works i gives me this error
Cannot find module '...\node_modules\@adiwajshing\baileys\lib\index.js'
From where you clone or download this
I used to use this module via require() but it no longer works i gives me this error
Cannot find module '...\node_modules\@adiwajshing\baileys\lib\index.js'
From where you clone or download this
yarn add github:WhiskeySockets/Baileys
I used to use this module via require() but it no longer works i gives me this error
Cannot find module '...\node_modules\@adiwajshing\baileys\lib\index.js'
From where you clone or download this
yarn add github:WhiskeySockets/Baileys
in which bot
in which bot
Don't understand the question (?)
in which bot
Don't understand the question (?)
In which folder you cloned or download it
I ran yarn add github:WhiskeySockets/Baileys
from the top folder of the project.
I ran
yarn add github:WhiskeySockets/Baileys
from the top folder of the project.
Can you give a folder link ?
Folder link?, you mean: /home/user/dev/wa-desktop/
In the error message, it says: `Cannot find module '...\node_modules@adiwajshing\baileys\lib\index.js'
But when looking at the Baileys files inside node_modules, the 'lib\index.js' file isn't there. Could this be because Baileys uses TypeScript (.ts) while my project is in JavaScript (.js)?
screenshot:
you are going the other way, the method indicated does not exist WAConnection
if you want to build you should use const { makeWASocket } = require('@adiwajshing/baileys');
const { makeWASocket } = require('@adiwajshing/baileys');
const { makeWASocket } = require('@adiwajshing/baileys');.default
changed to const { makeWASocket } = require('@adiwajshing/baileys');
Still getting the same error:
Error: Cannot find module '/home/user/dev/wa-desktop/node_modules/@adiwajshing/baileys/lib/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:416:19)
at Module._findPath (node:internal/modules/cjs/loader:658:18)
at Module._resolveFilename (node:internal/modules/cjs/loader:1040:27)
at o._resolveFilename (node:electron/js2c/renderer_init:2:3879)
at Module._load (node:internal/modules/cjs/loader:900:27)
at f._load (node:electron/js2c/asar_bundle:2:13330)
at o._load (node:electron/js2c/renderer_init:2:3109)
at Module.require (node:internal/modules/cjs/loader:1120:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/home/user/dev/assitant-desktop/app/view_preload.js:3:26)
(
This is the package.json of my Baileys:
{
"name": "@adiwajshing/baileys",
"version": "5.0.0",
"description": "WhatsApp API",
"homepage": "https://github.com/adiwajshing/Baileys",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"keywords": [
"whatsapp",
"js-whatsapp",
"whatsapp-api",
"whatsapp-web",
"whatsapp",
"whatsapp-chat",
"whatsapp-group",
"automation",
"multi-device"
],
"scripts": {
"test": "jest",
"prepare": "tsc",
"build:all": "tsc && typedoc",
"build:docs": "typedoc",
"build:tsc": "tsc",
"example": "node --inspect -r ts-node/register Example/example.ts",
"gen:protobuf": "sh WAProto/GenerateStatics.sh",
"lint": "eslint . --ext .js,.ts,.jsx,.tsx",
"lint:fix": "eslint . --fix --ext .js,.ts,.jsx,.tsx"
},
"author": "Adhiraj Singh",
"license": "MIT",
"repository": {
"url": "[email protected]:adiwajshing/baileys.git"
},
"dependencies": {
"@hapi/boom": "^9.1.3",
"axios": "^1.3.3",
"futoin-hkdf": "^1.5.1",
"libsignal": "https://github.com/adiwajshing/libsignal-node.git",
"music-metadata": "^7.12.3",
"node-cache": "^5.1.2",
"pino": "^7.0.0",
"protobufjs": "^6.11.3",
"ws": "^8.0.0"
},
"peerDependencies": {
"@adiwajshing/keyed-db": "^0.2.4",
"jimp": "^0.16.1",
"link-preview-js": "^3.0.0",
"qrcode-terminal": "^0.12.0",
"sharp": "^0.30.5"
},
"peerDependenciesMeta": {
"@adiwajshing/keyed-db": {
"optional": true
},
"jimp": {
"optional": true
},
"qrcode-terminal": {
"optional": true
},
"sharp": {
"optional": true
},
"link-preview-js": {
"optional": true
}
},
"files": [
"lib/*",
"WAProto/*",
"WASignalGroup/*.js"
],
"devDependencies": {
"@adiwajshing/eslint-config": "https://github.com/adiwajshing/eslint-config.git",
"@adiwajshing/keyed-db": "^0.2.4",
"@types/got": "^9.6.11",
"@types/jest": "^27.5.1",
"@types/node": "^16.0.0",
"@types/sharp": "^0.29.4",
"@types/ws": "^8.0.0",
"eslint": "^8.0.0",
"jest": "^27.0.6",
"jimp": "^0.16.1",
"link-preview-js": "^3.0.0",
"qrcode-terminal": "^0.12.0",
"sharp": "^0.30.5",
"ts-jest": "^27.0.3",
"ts-node": "^10.8.1",
"typedoc": "^0.22.0",
"typescript": "^4.0.0"
}
}
``
changed to
const { makeWASocket } = require('@adiwajshing/baileys');
Still getting the same error:Error: Cannot find module '/home/user/dev/wa-desktop/node_modules/@adiwajshing/baileys/lib/index.js'. Please verify that the package.json has a valid "main" entry at tryPackage (node:internal/modules/cjs/loader:416:19) at Module._findPath (node:internal/modules/cjs/loader:658:18) at Module._resolveFilename (node:internal/modules/cjs/loader:1040:27) at o._resolveFilename (node:electron/js2c/renderer_init:2:3879) at Module._load (node:internal/modules/cjs/loader:900:27) at f._load (node:electron/js2c/asar_bundle:2:13330) at o._load (node:electron/js2c/renderer_init:2:3109) at Module.require (node:internal/modules/cjs/loader:1120:19) at require (node:internal/modules/cjs/helpers:103:18) at Object.<anonymous> (/home/user/dev/assitant-desktop/app/view_preload.js:3:26) (
use yarn add @adiwajshing/baileys@github:WhiskeySockets
$ yarn add @adiwajshing/baileys@github:WhiskeySockets
yarn add v1.22.19
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...
error Invalid hosted git fragment "github:WhiskeySockets".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
$ yarn add @adiwajshing/baileys@github:WhiskeySockets yarn add v1.22.19 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... error Invalid hosted git fragment "github:WhiskeySockets". info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
try to run with npm i @adiwajshing/baileys@github:WhiskeySockets
$ npm i @adiwajshing/baileys@github:WhiskeySockets
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://[email protected]/null/WhiskeySockets.git
npm ERR! [email protected]: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2023-05-03T21_27_16_831Z-debug-0.log
$ npm i @adiwajshing/baileys@github:WhiskeySockets npm ERR! code 128 npm ERR! An unknown git error occurred npm ERR! command git --no-replace-objects ls-remote ssh://[email protected]/null/WhiskeySockets.git npm ERR! [email protected]: Permission denied (publickey). npm ERR! fatal: Could not read from remote repository. npm ERR! npm ERR! Please make sure you have the correct access rights npm ERR! and the repository exists. npm ERR! A complete log of this run can be found in: npm ERR! /home/user/.npm/_logs/2023-05-03T21_27_16_831Z-debug-0.log
can you told me what are you trying to do
$ npm i @adiwajshing/baileys@github:WhiskeySockets npm ERR! code 128 npm ERR! An unknown git error occurred npm ERR! command git --no-replace-objects ls-remote ssh://[email protected]/null/WhiskeySockets.git npm ERR! [email protected]: Permission denied (publickey). npm ERR! fatal: Could not read from remote repository. npm ERR! npm ERR! Please make sure you have the correct access rights npm ERR! and the repository exists. npm ERR! A complete log of this run can be found in: npm ERR! /home/user/.npm/_logs/2023-05-03T21_27_16_831Z-debug-0.log
try this yarn add @adiwajshing/baileys@github:WhiskeySockets/baileys
can you told me what are you trying to do
To require
Baileys into my project
can you told me what are you trying to do
To
require
Baileys into my project
which project