报错信息:

 eslint --fix [FAILED]
[32m[COMPLETED][39m Running tasks for staged files..
[33m[STARTED][39m Applying modifications from tasks...
[33m[SKlPPED][39m $kipped because of errors from tasks.
[33m[STARTED][39m Reverting to original state because of errors...
[32m[COMPLETED][39m Reverting to original state because of errors..
33m[STARTED][39m Cleaning up temporary files...
[32m[COMPLETED][39m Cleaning up temporany files...
Xeslint --fix:
Oops! Something went wrong! :(
ESLint: 9.9.1
SyntaxError: Unexpected token 'with'
at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:119:18)
at ESMLoader,moduleProvider (node:internal/modules/esm/loader:468:14)

场景:项目eslint 提示的格式问题修改后,提交失败,同事的代码可以提交,自己本地提交失败 报错以上内容。

原因: 由于切换项目时切换了node版本,但是当前项目 node 版本 20+;导致node版本不匹配,同时eslint 校验了 node的版本 所以报出这类错误。nvm 切换回该项目的node版本即可。

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐