Node.js & JQuery: “ReferenceError: $ is not defined” error. How do I use jquery with node on the server?

后端 未结 4 1585
太阳男子
太阳男子 2021-01-21 02:21

Help! I\'m trying to use jquery in my node.js app, but I keep getting an error when I try to use \'$\', saying \"$ is not defined\"... but I defined it at the top! Here\'s what

4条回答
  •  长发绾君心
    2021-01-21 02:47

    If you don't need a full DOM available and just want to parse and scrape/manipulate html elements, there is cheerio which is more lightweight than jsdom and still gives you a jQuery-like API.

提交回复
热议问题