How to Node Module install and usage(Help)

Hi all,
I have tried and read many posts… but did not manage to have this loaded.
I have loaded this
npm i whatsapp-web.js
after did Yarn add whatsapp-web.js

Now i can see the directory under node_modules
But because i want to have it on my custom_app i have just copied the Directory to app/custom_app/public/js

Now i have added on hooks.py
app_include_js = [“assets/js/whatsapp-web.js”]

Now when added on build.json
“js/whatsapp-web.js”: [
“public/js/whatsapp-web.js”
]

Now the way it is when start bench returns errors when Building whatsapp-web.js

custom_app/public/js/whatsapp-web.js/package.json
16:59:50 watch.1 | SyntaxError: Unexpected token (2:9)
16:59:50 watch.1 | 1 : {
16:59:50 watch.1 | 2 : “_from”: “whatsapp-web.js”,
16:59:50 watch.1 | ^
16:59:50 watch.1 | 1 : {
16:59:50 watch.1 | 2 : “_from”: “whatsapp-web.js”,
16:59:50 watch.1 | ^

Anyone to give the right path so i can have this loaded ?

Thanks in advance

I think it is a nodejs app and not js to be loaded in browser

Check this to add custom nodejs app How Add nodejs App to frappe & bench? - #7 by MartinHBramwell

1 Like

@revant_one thank you. You are correct is a nodejs app… Will have a look at the shared article.

Once again many thanks for the tips… i have managed for my Develop testing… :slight_smile:

Created files under my custom_app/public/js/
whazapp.html (with socket.io to receive messages, this case the QR from the NodeJs)
whazapp.js

Added on Procfile:
custom_app: /usr/bin/node apps/custom_app/custom_app/public/js/whazapp.js

1 Like