不确定我做错了什么,我正在遵循mailchimp开发人员的快速入门指南。https://mailchimp.com/developer/marketing/guides/quick-start/。我觉得我错过了关键的一步。我安装了webpack。我没有收到"一切都是黑猩猩"的提示音;相反,它只是烫发重新加载和突出显示需要在chrome开发工具的源代码点击。
突出显示'require'。
const mailchimp = require("@mailchimp/mailchimp_marketing");
mailchimp.setConfig({
apiKey: "7effff5342f8e4669e427c885b0b0088-us5",
server: "us5",
});
async function run() {
const response = await mailchimp.ping.get();
console.log(response);
}
run();
this is my package.json
{
"name": "mail-chimp",
"version": "1.0.0",
"main": "app.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@mailchimp/mailchimp_marketing": "^3.0.70",
"clone-deep": "^4.0.1",
"find-up": "^4.1.0",
"locate-path": "^5.0.0",
"npm-run-path": "^4.0.1",
"onetime": "^5.1.2",
"p-locate": "^4.1.0",
"p-try": "^2.2.0",
"path-exists": "^4.0.0",
"path-key": "^3.1.1",
"path-parse": "^1.0.7",
"picocolors": "^1.0.0",
"pkg-dir": "^4.2.0",
"punycode": "^2.1.1",
"randombytes": "^2.1.0",
"resolve": "^1.20.0",
"resolve-cwd": "^3.0.0",
"resolve-from": "^5.0.0",
"safe-buffer": "^5.2.1",
"serialize-javascript": "^6.0.0",
"shallow-clone": "^3.0.1",
"shebang-regex": "^3.0.0"
},
"devDependencies": {
"webpack": "^5.59.1",
"webpack-cli": "^4.9.1"
},
"description": ""
}
写这行代码:
import mailchimp from '@mailchimp/mailchimp_marketing'
它将开始工作。