ERROR require() of ES Module ...\node_modules\string-width\index.js from ...\node_modules\wide-align\align.js not supported.

nuxt3安装jq的依赖,其实不止jq,只要是安装个新的依赖就报错: ERROR require() of ES Module ...\node_modules\string-width\index.js from ...\node_modules\wide-align\align.js not supported.

解决方案:

删掉yarn.lock重新yarn

以下废除

删掉yarn.lock 和node_modules重新安装则没问题,然后在 githubgithub 上找到了相关解决方法,在你的package.json里添加:

  "resolutions": {
    "jackspeak": "3.1.2"
  },

其中jackspeak的版本可以按照jackspeak最新的来安装,我是根据提示安的@3.2.1

然后删掉yarn.lock和node_modules重新yarn即可

祝你 success Saved lockfile.

posted @ 2024-10-17 10:07  沈瀚  阅读(150)  评论(0)    收藏  举报