robertsLando / node-red-contrib-whatsappbot

Whatsapp Bot 🤖 for Node-Red
MIT License
38 stars 18 forks source link

QR Code not showing up #1

Closed dmastag closed 4 years ago

dmastag commented 4 years ago

Hi There I tried using this but unfortunately no QR Code is showing up. Currently am using node-red using Docker.

image

dmastag commented 4 years ago

Was looking into the Logs and got this

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md

Chrome not found, using chromium
12 Apr 11:10:28 - [error] [whatsapp-client:2e99f915.7f8316] Error while starting Whatsapp client "session": Failed to launch the browser process! spawn /usr/src/node-red/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome ENOENT
robertsLando commented 4 years ago

I think that the node hasn't been installed correctly on you machine. Try to go in ~./node-red directory and run npm install node-red-contrib-whatsappbot. Check that no error is thrown and then restart node-red. Also try to install chrome on your local machine to have better support

dmastag commented 4 years ago

Got it working now, so I was using Docker with nodered/node-red which is alpine based Here are the steps I did which can hopefully help someone else

To get it working I created a Dockerfile using the information in https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#running-on-alpine

FROM nodered/node-red

# Copy package.json to the WORKDIR so npm builds all
# of your added modules for Node-RED
# COPY package.json .
# RUN npm install --only=production

RUN npm install -E node-red-dashboard
RUN npm install -E node-red-contrib-whatsappbot
RUN npm install -E node-red-node-ui-table

USER root

# From https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#running-on-alpine
# Installs latest Chromium (77) package.
RUN apk add --no-cache \
      chromium \
      nss \
      freetype \
      freetype-dev \
      harfbuzz \
      ca-certificates \
      ttf-freefont
      # nodejs \  -->  nodered/node-red already has nodejs in it
      # yarn --> don't use yarn

# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

## Changed this to use the node-red user
# Add user so we don't need --no-sandbox.
RUN mkdir -p /home/pptruser/Downloads /app \
    && chown -R node-red:node-red /home/pptruser \
    && chown -R node-red:node-red /app

# Run everything after as non-privileged user.
USER node-red

# Copy _your_ Node-RED project files into place
# COPY settings.js /data/settings.js
# COPY flows_cred.json /data/flows_cred.json
# COPY flows.json /data/flows.json

# Start the container normally
CMD ["npm", "start"]

And then run using docker run -it -p 1880:1880 -v /my/local/data:/data --privileged --name mynodered name-of-image

Please bear in mind that it has to be privileged

robertsLando commented 4 years ago

Thanks for sharing this info, glad you fixed it :)

——————

Daniel - Software Engineer

Support me at: Github sponsors

On 12 Apr 2020, at 13:40, Julian Alimin notifications@github.com wrote:

 Got it working now, so I was using Docker with nodered/node-red which is alpine based Here are the steps I did which can hopefully help someone else

To get it working I created a Dockerfile using the information in https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#running-on-alpine

FROM nodered/node-red

Copy package.json to the WORKDIR so npm builds all

of your added modules for Node-RED

COPY package.json .

RUN npm install --only=production

RUN npm install -E node-red-dashboard RUN npm install -E node-red-contrib-whatsappbot RUN npm install -E node-red-node-ui-table

USER root

From https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#running-on-alpine

Installs latest Chromium (77) package.

RUN apk add --no-cache \ chromium \ nss \ freetype \ freetype-dev \ harfbuzz \ ca-certificates \ ttf-freefont

nodejs \ --> nodered/node-red already has nodejs in it

  # yarn --> don't use yarn

Tell Puppeteer to skip installing Chrome. We'll be using the installed package.

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

Changed this to use the node-red user

Add user so we don't need --no-sandbox.

RUN mkdir -p /home/pptruser/Downloads /app \ && chown -R node-red:node-red /home/pptruser \ && chown -R node-red:node-red /app

Run everything after as non-privileged user.

USER node-red

Copy your Node-RED project files into place

COPY settings.js /data/settings.js

COPY flows_cred.json /data/flows_cred.json

COPY flows.json /data/flows.json

Start the container normally

CMD ["npm", "start"] — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.