require() ode_modules\string-width\index.js 来自 不支持 ode_modules\wide-align lign.js

问题描述 投票:0回答:1

这里的问题似乎是由您的包管理器引起的。请参阅 stackblitz 中的以下日志: Image of An ErrorImage of An Error

现在我多次刷新锁定文件。以 Stackblitz 为例 - 我刷新那里的锁文件,它可以工作,但是然后我在本地复制该锁文件,问题仍然存在,而我在本地刷新(并且有可能没有帮助)并复制到 Stackblitz,然后容器失败.

yarn安装的string-width的实际版本是v5,似乎与wide-align不兼容。 恐怕这不是我们可以解决的 Nuxt 问题。

尽管使用该解决方案,删除了yarn.lock和node_modules文件夹,但它仍然有效,尽管它警告请求的版本之间不兼容。

wide-align,npmlog 使用,vite 使用,最终强制使用 string-width<5, which from what I understand, was a dependency that yarn failed to comply with, causing the error.

来自 Wide-align package.json:

"//": "But not version 5 of string-width, as that's ESM only",   "dependencies": {     "string-width": "^1.0.2 || 2 || 3 || 4"

再次,使用分辨率似乎是有效的,只要你没有对字符串宽度 ^5 的依赖,它应该没问题,但它可能真的很烦人。 Wide-align 已经闲置了 2 年多了,我怀疑我们很快就能得到他们的修复。我稍后可能会做一个 PR 来修复它

yarnpkg require commonjs notsupportedexception esmodules
1个回答
0
投票

在您的 Package.json 中添加此行

“决议”:{“字符串宽度”:“4.2.3”}

“决议”:{“jackspeak”:“2.1.1”}

然后这样做

删除node_modules文件夹和yarn.lock package.lock文件。 运行 npm/yarn install。

© www.soinside.com 2019 - 2024. All rights reserved.