Comments (43)
You don't need yarn anymore using the normal npm already get the latest version and it works perfectly.
https://www.npmjs.com/package/@whiskeysockets/baileys
from baileys.
We are working on this, we have an NPM org ready
from baileys.
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
from baileys.
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
from baileys.
Did it. same error
Baileys,
package.json
file contains"main": "lib/index.js",
but that file is clearly not present in the codehttps://github.com/WhiskeySockets/Baileys/blob/master/package.json
I wonder why
still having issue try yarn add @adiwajshing/baileys@npm:@queenanya/[email protected]
from baileys.
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
from baileys.
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
from baileys.
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]
from baileys.
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
from baileys.
The truth is that I have not understood very well, when you say single auth
from 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 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'
share screenshot of your package.json
from 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'
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)
(```
from 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
from 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
from 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
from baileys.
in which bot
Don't understand the question (?)
from baileys.
in which bot
Don't understand the question (?)
In which folder you cloned or download it
from baileys.
I ran yarn add github:WhiskeySockets/Baileys
from the top folder of the project.
from baileys.
I ran
yarn add github:WhiskeySockets/Baileys
from the top folder of the project.
Can you give a folder link ?
from baileys.
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:
from baileys.
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');
from baileys.
const { makeWASocket } = require('@adiwajshing/baileys');
const { makeWASocket } = require('@adiwajshing/baileys');.default
from baileys.
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)
(
from baileys.
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"
}
}
from baileys.
``
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
from baileys.
$ 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.
from baileys.
$ 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
from baileys.
$ 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
from baileys.
$ 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
from baileys.
$ 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
from baileys.
can you told me what are you trying to do
To require
Baileys into my project
from baileys.
can you told me what are you trying to do
To
require
Baileys into my project
which project
from baileys.
whatsapp desktop app using electron
from baileys.
whatsapp desktop app using electron
oh
try this yarn add @adiwajshing/baileys@github:WhiskeySockets/baileys
if this will show trouble with network then use npm i instead of yarn add
from baileys.
still brings me the same error for require
Eror: 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)
from baileys.
still brings me the same error for
require
Eror: 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)
First remove old @adiwajshing/baileys
Then try
yarn add @adiwajshing/baileys@github:WhiskeySockets/baileys
from baileys.
Did it. same error
Baileys, package.json
file contains "main": "lib/index.js",
but that file is clearly not present in the code
https://github.com/WhiskeySockets/Baileys/blob/master/package.json
I wonder why
from baileys.
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
Then i don't know ask to @PurpShell and @andresayac
from baileys.
We are working on this, we have an NPM org ready
Is there any update on when will you release it?
from baileys.
I had troubles as well using baileys in a CJS node project (using require() instead of IMPORT)
They way I solved is as follows
const makeWASocketCont = require("@whiskeysockets/baileys");
const makeWASocket = makeWASocketCont.default;
const { useMultiFileAuthState, DisconnectReason } = makeWASocketCont;
from baileys.
You don't need yarn anymore using the normal npm already get the latest version and it works perfectly.
But how can u install module now a days npm has some issue than the other option is yarn to use
from baileys.
I had troubles as well using baileys in a CJS node project (using require() instead of IMPORT)
They way I solved is as follows
const makeWASocketCont = require("@whiskeysockets/baileys"); const makeWASocket = makeWASocketCont.default; const { useMultiFileAuthState, DisconnectReason } = makeWASocketCont;
You can use
const makeWASocket = require("@whiskeysockets/baileys").default;
from baileys.
Related Issues (20)
- Emoji Reaction HOT 3
- [BUG] How fix Connection Terminate? HOT 1
- Is there a way to access whatsapp channel?
- [BUG] How to send an event invitation message in a group with the community
- [BUG] SCHEDULE CALL -> WAITING MESSAGE
- [BUG] unable to get message.update event from poll vote HOT 1
- [BUG] Baileys
- [BUG] Looping in message.upsert HOT 2
- Send Media Message Memory Leak HOT 3
- [BUG] makeInMemoryStore HOT 2
- [BUG] HOT 1
- [BUG]
- [BUG] HOT 3
- [BUG] HOT 6
- Request Adding Charge Buyer for WhatsApp Bussiness HOT 1
- [BUG] Broadcast option is not present in the message options
- [BUG] HOT 1
- [BUG] Stream errored out after QR scan HOT 3
- [BUG] HOT 2
- [BUG] Error playing audio on iOS/WA (Windows) devices HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from baileys.