簡體   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