繁体   English   中英

什么是 TypeError: require(...)(...) is not a function 当我尝试运行我的 playWright 脚本时?

[英]What is the TypeError: require(…)(…) is not a function when I try to run my playWright script?

我目前正在将部分自动化脚本移动到不同的文件中,以便更轻松地维护整个脚本,我遇到了这个问题。

$ node ./playWright/index
    D:\Lambda\projects\puppeteer_test\playWright\index.js:6
    })();
  ^

TypeError: require(...)(...) is not a function
    at Object.<anonymous> (D:\Lambda\projects\puppeteer_test\playWright\index.js:6:3)

将您的 index.js 启动 function 从

(async () => { // Start of async arrow function
  // Function code
  // ...
})(); // End of the function and () to invoke itself

到一个正常的异步 function

async function index() {
  await downloadFile()
  console.log("Test")
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM