3

运行三个代码块时不断收到以下错误。由于某种原因,这些错误似乎表明在某些情况下未加载原型。我正在运行这个 NodeJS(作为 VSCode 扩展)。有什么想法吗?

error TypeError: this._createSingle is not a function
extension.js:65
    at Tooling.Connection.insert.Connection.create (/Users/michaelgarfinkel/Documents/forcecompiler/node_modules/jsforce/lib/connection.js:727:12)
    at compile (/Users/******/Documents/*******/extension.js:58:29)
    at /Users/michaelgarfinkel/Documents/forcecompiler/extension.js:126:17
    at /Users/michaelgarfinkel/Documents/forcecompiler/node_modules/jsforce/lib/promise.js:72:9
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

我先运行这个

conn = new jsforce.Connection({
    // you can change loginUrl to connect to sandbox or prerelease env.
    loginUrl: 'https://test.salesforce.com',
    version: '43.0'
});

这一秒

conn.login(username, password, function(err, userInfo) {
    if (err) {
        console.error(err);
        reject(err);
    } else {
        // Now you can get the access token and instance URL information.
        // Save them to establish connection next time.
        console.log(conn.accessToken);
        console.log(conn.instanceUrl);
        // logged in user property
        console.log("User ID: " + userInfo.id);
        console.log("Org ID: " + userInfo.organizationId);
        // ...
        console.log('conn', conn);
    }
});

而这第三

return conn.tooling.sobject('ApexClass').create({
    body: apexBody
}, function (err, res) {
    if (err) { return console.error(err); }
    console.log(res);
});
4

0 回答 0