whatsapp-api icon indicating copy to clipboard operation
whatsapp-api copied to clipboard

Unable to run the server

Open arktnld opened this issue 1 year ago • 4 comments

Hello everyone,

I was having trouble running the server, but I managed to find a solution. Here's a step-by-step guide to help others who might be facing the same issue, this was tested on Ubuntu 22.

Change whatsapp-web.js Version in package.json:

  • Change the line in the package.json file from:
    "whatsapp-web.js": "1.23.1-alpha.5"
    
    to:
    "whatsapp-web.js": "github:pedroslopez/whatsapp-web.js#webpack-exodus"
    
  • Remove the package-lock.json file from the project.

Install Node.js 20.x LTS:

  • Update and upgrade the system
  • Remove previous versions of Node.js and npm
  • Use the script provided by NodeSource to add the Node.js 20.x LTS repository to your system:
    curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
    
  • Install Node.js 20.x LTS:
    sudo apt install nodejs -y
    

Install Forever and Start the Server:

  • Create a .env file to store environment variables necessary for server configuration.
  • Install the forever package globally:
    npm install -g forever
    
  • Start the server using forever to ensure it continues running even after the terminal is closed:
    forever start server.js
    

arktnld avatar Apr 04 '24 12:04 arktnld

Hi,

So when I try forever start server.js, I receive this error:

(Use `node --trace-warnings ...` to show where the warning was created)
(node:1163) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(node:1163) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency```

GuilhermeScherner avatar Apr 04 '24 15:04 GuilhermeScherner

The error is gone but session is not getting connected

sunilsankar avatar Apr 04 '24 15:04 sunilsankar

Hi,

So when I try forever start server.js, I receive this error:

(Use `node --trace-warnings ...` to show where the warning was created)
(node:1163) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(node:1163) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency```

This is just a warning. Type forever list to list yours running servers, forever logs 0 to show the logs of the first server.

arktnld avatar Apr 08 '24 00:04 arktnld

Please use the latest docker version 🙏

chrishubert avatar Apr 10 '24 06:04 chrishubert