Web Services Node.js从12.x升级到16.x Alexa控制台,自动升级,在WCF.js,WS.js,Security.js中引起错误

0ve6wy6x  于 11个月前  发布在  Node.js
关注(0)|答案(1)|浏览(125)

**使用Node.js时出现以下错误:**出现错误。Error [ERR_REQUIRE_ESM]:require()of ES Module/var/task/node_modules/dateformat/lib/dateformat.js from/var/task/node_modules/ws.js/lib/handlers/client/security/security.js not supported. Instead change the require of dateformat.js in/var/task/node_modules/ws.js/lib/handlers/client/security/security.js to a dynamic import()that is available in all CommonJS modules.

这是在我从Node.js 12.x版本自动升级到16.x之后发生的。我的技能使用WCF.js,它调用WS.js,WS.js调用security.js来调用.NET Web服务。

hkmswyz6

hkmswyz61#

使用fix esm https://www.npmjs.com/package/fix-esm模块并像这样导入模块:
const someModule = require(“fix-esm”).require(“some-module”);
否则,您可以将模块版本降级为稳定的旧版本。

相关问题