脚本nodejs的ReferenceError

时间:2017-05-30 14:06:52

标签: javascript node.js

我收到以下错误:

"Uncaught ReferenceError: Invalid left-hand side in assignment"

从这段代码:

const cheerioReq = require("cheerio-req");

//noinspection JSAnnotator
cheerioReq("https://my.alpinegqs.com/", (err, $) = {
  console:log($(".header h1").text()),

});

2 个答案:

答案 0 :(得分:-1)

你错过了一支箭。试试这个:

const cheerioReq = require("cheerio-req");

//noinspection JSAnnotator
cheerioReq("https://my.alpinegqs.com/", (err, $) => {
  console.log($(".header h1").text()),

});

答案 1 :(得分:-1)

const cheerioReq = require("cheerio-req");

//noinspection JSAnnotator
cheerioReq("https://my.alpinegqs.com/", (err, $) => {
  console:log($(".header h1").text()),

});

那应该是箭头功能吗?在(err, $) =之后,您需要一个>