简体   繁体   English

ESLint 8.31.0“错误:无法加载在‘.eslintrc.js » eslint-config-standard’中声明的插件‘import’:找不到模块‘array.prototype.flatmap’”

[英]ESLint 8.31.0 "Error: Failed to load plugin 'import' declared in '.eslintrc.js » eslint-config-standard': Cannot find module 'array.prototype.flatmap"

Am new to Node and npm in general but I'm pretty sure I've gotten the hang at installing packages locally and whatnot.一般来说,我是 Node 和 npm 的新手,但我很确定我已经掌握了在本地安装软件包等方面的知识。 However, I've been trying to get eslint to work for awhile now and it always fails with the same error message despite trying multiple different test projects.但是,我一直在尝试让 eslint 工作一段时间,尽管尝试了多个不同的测试项目,但它总是失败并显示相同的错误消息。 It keeps saying that it cannot find a module 'array.prototype.flatmap' (pic provided below).它一直说找不到模块“array.prototype.flatmap”(下面提供的图片)。 Node is v18.13.0 and npm is v8.19.3 so I'm up to date.节点是 v18.13.0,npm 是 v8.19.3,所以我是最新的。 ESLint: ^8.31.0. ESLint:^8.31.0。

My steps are (after using 'npm init' to create a package.json file):我的步骤是(在使用“npm init”创建一个 package.json 文件之后):

 1. Locally install eslint to project directory using 'npm init @eslint/config' as shown on the site. (I also tried 'npm install -D eslint' AND THEN 'npm init @eslint/config' to configure after installing. 

 2. [Configs](https://i.stack.imgur.com/88f4V.png) I have tried with both standard and airbnb configs. 

 3. Have looked up vids that said to add a script to package.json: "scripts": { "lint": "eslint ./" } and running 'npm run lint'. This results in an error. 

 4. Have tried running npx eslint 'filename.js' .... same error.

This is the error I keep getting: Error msg:这是我不断收到的错误:错误消息:

Have tried repeatedly uninstalling packages, reinstalling, different directories and different projects.已尝试反复卸载软件包、重新安装、不同目录和不同项目。 Even tried other stackoverflow responses to similar issues with different modules, but no avail.甚至尝试了对不同模块的类似问题的其他 stackoverflow 响应,但无济于事。 The module that always gives me a problem seems to be 'array.prototype.flatmap'.总是给我出问题的模块似乎是“array.prototype.flatmap”。

Not sure where to from this point.不知道从哪里开始。 Although I do not NEED eslint and might not use it all the time in the future, I don't want to give up trying simply because I'm having installation issues.尽管我不需要 eslint 并且将来可能不会一直使用它,但我不想仅仅因为遇到安装问题而放弃尝试。

I had the same problem.我有同样的问题。 I found this comment and bumped eslint-plugin-import lib.我发现了这个评论并碰到了eslint-plugin-import lib。

// package.json

"eslint-plugin-import": "^2.27.2",

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 npm init nuxt-app 结果出现问题“无法加载在‘.eslintrc.js » @nuxtjs/eslint-config’中声明的插件‘unicorn’” - npm init nuxt-app results a problem "Failed to load plugin 'unicorn' declared in '.eslintrc.js » @nuxtjs/eslint-config'" WebStorm eslint-config-standard错误 - WebStorm eslint-config-standard error 必须使用import加载ES Module.eslintrc.js - Must use import to load ES Module .eslintrc.js 无法加载在 'package.json » eslint-config-react-app#overrides[0]' 中声明的解析器 '@typescript-eslint/parser':找不到模块 'typescript' - Failed to load parser '@typescript-eslint/parser' declared in 'package.json » eslint-config-react-app#overrides[0]': Cannot find module 'typescript' ReactJS:无法加载在“package.json”中声明的插件“testing-library”:找不到模块“./eslint-utils” - ReactJS : Failed to load plugin 'testing-library' declared in 'package.json : Cannot find module './eslint-utils' 错误:.eslintrc.js 中的 ESLint 配置无效:-意外的顶级属性“文件” - Error: ESLint configuration in .eslintrc.js is invalid: - Unexpected top-level property "files" 无法加载在“package.json » eslint-config-react-app/jest”中声明的插件“jest”:无法读取未定义的属性(读取“meta”) - Failed to load plugin 'jest' declared in 'package.json » eslint-config-react-app/jest': Cannot read properties of undefined (reading 'meta') Mac WebStorm错误:无法找到模块'eslint-config-airbnb' - Mac WebStorm Error: Cannot find module 'eslint-config-airbnb' 带有 Babel 的 ESLint:在 .eslintrc 中未找到声明的 plugin-proposal-class-properties - ESLint with Babel: plugin-proposal-class-properties not found declared in .eslintrc 为什么javascript中没有Array.prototype.flatMap? - Why no Array.prototype.flatMap in javascript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM