pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
15.53k stars 3.7k forks source link

error when installing whatsapp-web.js #222

Closed fdciabdul closed 4 years ago

fdciabdul commented 4 years ago

how to fix it ?

 # npm i whatsapp-web.js
loadDep:puppeteer → resol ▌ ╢█████░░░░░░░░░░░░░░░░░░╟
WARN engine puppeteer@3.1.0: wanted: {"node":">=10.18.
> puppeteer@3.1.0 install /root/wabot/node_modules/whatsapp-web.js/node_modules/puppeteer
> node install.js

/root/wabot/node_modules/whatsapp-web.js/node_modules/puppeteer/install.js:175
            } catch {
                    ^

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
coronanotifier@1.0.0 /root/wabot
├── puppeteer@3.0.0  extraneous
└── puppeteer-core@3.1.0  extraneous

npm WARN ws@7.3.0 requires a peer of bufferutil@^4.0.1 but none was installed.
npm WARN ws@7.3.0 requires a peer of utf-8-validate@^5.0.2 but none was installed.
npm WARN ws@7.3.0 requires a peer of bufferutil@^4.0.1 but none was installed.
npm WARN ws@7.3.0 requires a peer of utf-8-validate@^5.0.2 but none was installed.
npm WARN ws@7.3.0 requires a peer of bufferutil@^4.0.1 but none was installed.
npm WARN ws@7.3.0 requires a peer of utf-8-validate@^5.0.2 but none was installed.
npm WARN coronanotifier@1.0.0 No repository field.
npm ERR! Linux 4.15.0-96-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i" "whatsapp-web.js"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! puppeteer@3.1.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer@3.1.0 install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the puppeteer package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs puppeteer
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls puppeteer
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/wabot/npm-debug.log
aliyss commented 4 years ago

Try deleting your node_modules folder and the package-lock.json

fdciabdul commented 4 years ago

Try deleting your node_modules folder and the package-lock.json

same

# ls
1.txt  CoronaService  index.js       Quran.js   shrinkwrap.yaml 2.txt  Diagram.png    npm-debug.log  README.md  user.js
root@vultr:~/wabot# npm i whatsapp-web.js                       loadDep:puppeteer → resol ▌ ╢███████░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine puppeteer@3.1.0: wanted: {"node":">=10.18.1"} (curreloadDep:ws → addNameRange ▌ ╢███████████░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine extract-zip@2.0.0: wanted: {"node":">= 10.12.0"} (cu
> puppeteer@3.1.0 install /root/wabot/node_modules/puppeteer
> node install.js

/root/wabot/node_modules/puppeteer/install.js:175
            } catch {
                    ^                                           
SyntaxError: Unexpected token {                                     at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)                       at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)                   at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3                                  /root/wabot
├── @pedroslopez/moduleraid@4.1.0                               ├── jsqr@1.3.1
└── mime@2.4.5                                                  
npm WARN enoent ENOENT: no such file or directory, open '/root/wabot/package.json'
npm WARN ws@7.3.0 requires a peer of bufferutil@^4.0.1 but none was installed.
npm WARN ws@7.3.0 requires a peer of utf-8-validate@^5.0.2 but none was installed.
npm WARN wabot No description
npm WARN wabot No repository field.
npm WARN wabot No README data
pedroslopez commented 4 years ago

What version of nodejs are you using? Check by running node -v

fdciabdul commented 4 years ago

Screenshot_2020_0527_004723

it showing v.8.10.0

pedroslopez commented 4 years ago

Screenshot_2020_0527_004723

it showing v.8.10.0

Puppeteer requires v10.18.1+. Please update your node installation and you should be good to go!

fdciabdul commented 4 years ago

thanks , now is working fine to me

root@vultr:~# nvm install 10.15.3
Downloading and installing node v10.15.3...
Downloading https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xz...
################################################################################# 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v10.15.3 (npm v6.4.1)
Creating default alias: default -> 10.15.3 (-> v10.15.3)
root@vultr:~# node -v
v10.15.3
root@vultr:~# cd wabot
root@vultr:~/wabot# npm i whatsapp-web.js

> puppeteer@3.1.0 install /root/wabot/node_modules/puppeteer
> node install.js

(node:9390) ExperimentalWarning: The fs.promises API is experimental
Downloading Chromium r756035 - 125.2 Mb [=================] 100% 0.0s
Chromium (756035) downloaded to /root/wabot/node_modules/puppeteer/.local-chromium/linux-756035
npm WARN saveError ENOENT: no such file or directory, open '/root/wabot/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/root/wabot/package.json'
npm WARN ws@7.3.0 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws@7.3.0 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN wabot No description
npm WARN wabot No repository field.
npm WARN wabot No README data
npm WARN wabot No license field.

+ whatsapp-web.js@1.6.0
added 46 packages from 74 contributors and audited 49 packages in 9.798s
found 0 vulnerabilities