Installing WPPConnect-Server for Windows
I need to try some WPPConnect-server from github repositories, in the following location https://wppconnect.io/docs/projects/wppserver/installation
But since I am travelling and only have access to Windows machine, so I am attempting to install npm for Windows. Here are the steps that I have followed and hopefully it helps others that are in the same boat.
Step 1. Download and install Node.js & npm
Download node.js from the following location https://nodejs.org/en/download
Once installed, you can start the command prompt using the following:
cmd
npm -v
npm install -g npm
node -v
if you get the version number of npm, e.g.: 10.5.0 and v20.12.0 for node.js then you know that you are on the right track.
Step 2. Install the NVM manager
Download and install the nvm manager from the following location https://github.com/coreybutler/nvm-windows/releases
During the install it should have detected your earlier version 20 of node.js and offer to manage it. So click ok to continue the install. If you open a new cmd prompt and issue the following:
cmd
nvm -v
You should see the version of nvm, e.g.: 1.1.12. This is the latest version at the time of writing.
Step 3. Install Gitdownload for Windows
Download and install gitdownload for windows from the following location https://git-scm.com/download/win
When you have finish the install you will be offered whether you want to open the git bash, select the radio button to open git bash and you should see the following prompt
Download the repository using the following command
git clone https://github.com/wppconnect-team/wppconnect-server.git && cd wppconnect-server
I encountered a few error when downloading the repository
error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8)
error: 4362 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
I updated the buffer size using the following command
git config --global http.postBuffer 157286400
And still encountered the following error
error: 2078 bytes of body are still expectediB | 280.00 KiB/s
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
so I increased the buffer size slightly to fix the problem
git config --global http.postBuffer 157886400
Step 4. Install yarn
Yarn is the package manager replacement to npm, you will need node.js installed before installing yarn. You can install yarn using the following link https://classic.yarnpkg.com/latest.msi
Then start a new command prompt using the following
cmd yarn dev
When I am trying to execute yarn dev, I encountered the following error
'tsx' is not recognized as an internal or external command, operable program or batch file. error Command failed with exit code 1.
to fix this error you can use this command
npm install -g typescript
then I encountered another error when running “yarn dev” inside the “wpconnect-server” folder
yarn run v1.22.19 warning ..\package.json: No license field $ tsx watch src/server.ts C:\Users\effen\wppconnect-server\node_modules\sharp\lib\sharp.js:114 throw new Error(help.join('\n')); ^ Error: Could not load the "sharp" module using the win32-x64 runtime Possible solutions: - Ensure optional dependencies can be installed: npm install --include=optional sharp yarn add sharp --ignore-engines - Ensure your package manager supports multi-platform installation: See https://sharp.pixelplumbing.com/install#cross-platform - Add platform-specific dependencies: npm install --os=win32 --cpu=x64 sharp - Consult the installation documentation: See https://sharp.pixelplumbing.com/install at Object.<anonymous> (C:\Users\effen\wppconnect-server\node_modules\sharp\lib\sharp.js:114:9) at Module._compile (node:internal/modules/cjs/loader:1369:14) at Object.S (C:\Users\effen\wppconnect-server\node_modules\tsx\dist\cjs\index.cjs:1:1292) at Module.load (node:internal/modules/cjs/loader:1206:32) at Module._load (node:internal/modules/cjs/loader:1022:12) at Module.require (node:internal/modules/cjs/loader:1231:19) at require (node:internal/modules/helpers:179:18) at Object.<anonymous> (C:\Users\effen\wppconnect-server\node_modules\sharp\lib\constructor.js:10:1) at Module._compile (node:internal/modules/cjs/loader:1369:14) at Object.S (C:\Users\effen\wppconnect-server\node_modules\tsx\dist\cjs\index.cjs:1:1292) Node.js v20.12.0
To fix the above, I followed the instructions from the error by executing
npm install --include=optional sharp yarn add sharp --ignore-engines npm install --os=win32 --cpu=x64 sharp
Then the execution of yarn dev is successful
Now, you can point your browser to http://localhost:21465/api-docs, and you should be presented with the WPPConnect API Rest.
Hopefully the above information is useful for you and can help you in your installation.