auto.js 错误: ERR_REQUIRE_ESM - 无法使用 require() 加载 ES 模块
auto.js 错误 'ERR_REQUIRE_ESM: Must use import to load ES Module: /storage/emulated/0/脚本/node_modules/axios/index.js require() of ES modules is not supported. require() of /storage/emulated/0/脚本/node_modules/axios/index.js from /storage/emulated/0/脚本/gpt.js is an ES module file as it is a .js file whose nearest parent package.json contains 'type': 'module' which defines all .js files in that package scope as ES modules. Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove 'type': 'module' from /storage/emulated/0/脚本/node_modules/axios/package.json.'
这个报错意味着你正在使用一个 ES 模块文件,但是尝试使用 require() 来加载它。这是不支持的,因为 require() 只能用于加载普通的 CommonJS 模块。报错信息中给出了几个解决方案,包括将文件扩展名改为 .cjs、改为使用 import(),或者从 package.json 中删除 'type': 'module'。
原文地址: https://www.cveoy.top/t/topic/ocjV 著作权归作者所有。请勿转载和采集!