Use the mqtt service in node, run the command
node mqttserver.js, and find an error: the
mosca package is missing:
Error: Cannot find module 'mosca'
Then install one,
npm install mosca
node mqttserver.js again, I found that it still reported an error
SchemaError: Expected `schema` to be an object or boolean
Copy the path underlined in red in the image below
Open a random folder, paste the path into the navigation bar, press Enter, you will enter the
lib and see the
Open this file with a text editor, slide to the position around the
108 line, comment out the three lines of code in the red circle in the figure below, and save
Run it again, node mqttserver.js
mqtt runs successfully.