joh*_*nnE 5 javascript node.js smartsheet-api
尝试使用这个 smartsheet api:http ://smartsheet-platform.github.io/api-docs/?javascript#node.js-sample-code
并告诉我为 nodejs 执行此操作:
var client = require('smartsheet');
var smartsheet = client.createClient({accessToken:'ACCESSTOKEN'});
Run Code Online (Sandbox Code Playgroud)
因此,我在 main.js 文件中执行此操作,但出现错误:未捕获的 ReferenceError:需要未定义
我认为这是因为我是 nodejs/npm 的新手,但我无法在任何地方找到它来实际放置这个 require 函数。我想我需要弄乱我的 node.js 文件,但我完全确定。非常感谢任何指向文档或建议的链接!
gya*_*eep 26
尝试从 package.json 中删除 "type": "module"
小智 6
将所有 require 语句替换为 import 语句。例子:
//BEFORE:
var client = require('smartsheet');
//AFTER:
import client from 'smartsheet';
Run Code Online (Sandbox Code Playgroud)
为我工作。