嗨尝试在我非常简单的应用程序上安装粉笔,然后我收到错误:
Error [ERR_REQUIRE_ESM]: require() of ES Module my-file-is-here and chalk\node_modules\chalk\source\index.js from my-file-is-here not supported.
Instead change the require of index.js in my-file-is-here to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (`my-file-is-here`) {
code: 'ERR_REQUIRE_ESM'
}
那是我的代码:
const os = require("os")
const chalk = require("chalk")
console.log("app running")
原文由 Elad87 发布,翻译遵循 CC BY-SA 4.0 许可协议
粉笔 5 已更改为 ESM。他们提供了一个链接以更好地理解这意味着什么: 纯 ESM 。
从粉笔自述文件:
截至本回复,粉笔 4 的最后一个版本是
4.1.2
。