[英]ERR undefined while installing airbnb eslint
npx install-peerdeps --dev eslint-config-airbnb
install-peerdeps v3.0.3
Installing peerdeps for eslint-config-airbnb@latest.
npm install eslint-config-airbnb@18.2.1 eslint@^7.2.0 eslint-plugin-import@^2.22.1 eslint-plugin-jsx-a11y@^6.4.1 eslint-plugin-react@^7.21.5 eslint-plugin-react-hooks@^1.7.0 --save-dev
ERR undefined
idk what's that.我知道那是什么。 Already tried to reinstall node(both LTS and current).
已经尝试重新安装节点(LTS 和当前)。 The path variable is valid.
路径变量有效。
I resolved this by explicitly installing the dependent npm packages ie npm install [package]@[version] --save-dev
rather than using the npx install-peerdeps
shortcut.我通过显式安装依赖的 npm 包解决了这个问题,即
npm install [package]@[version] --save-dev
而不是使用npx install-peerdeps
快捷方式。
The npm package page for eslint-config-airbnb details how to list the dependencies using: npm info "eslint-config-airbnb@latest" peerDependencies
eslint-config-airbnb的 npm package 页面详细介绍了如何使用:
npm info "eslint-config-airbnb@latest" peerDependencies
For version 18.2.1
this gave:对于
18.2.1
版本,这给出了:
{
eslint: '^5.16.0 || ^6.8.0 || ^7.2.0',
'eslint-plugin-import': '^2.22.1',
'eslint-plugin-jsx-a11y': '^6.4.1',
'eslint-plugin-react': '^7.21.5',
'eslint-plugin-react-hooks': '^4 || ^3 || ^2.3.0 || ^1.7.0'
}
Log files showing details about the error are located at ~/.npm/_logs/
.显示有关错误详细信息的日志文件位于
~/.npm/_logs/
。
The log file shows that npx install-peerdeps
chooses ^7.2.0
for eslint
and ^1.7.0
for eslint-plugin-react-hooks
.日志文件显示
npx install-peerdeps
为 eslint 选择^7.2.0
,为eslint
eslint-plugin-react-hooks
选择^1.7.0
。 BUT the latter eslint-plugin-react-hooks@^1.7.0
requires eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0"
(according to the log file) hence the error resolving the dependency tree.但是后者
eslint-plugin-react-hooks@^1.7.0
需要eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0"
(根据日志文件)因此解决依赖关系树的错误。
I explicitly installed the latest of all packages (ie npm install eslint --save-dev
etc) which installed the following versions (from package.json) which are in line with the dependencies above.我明确安装了所有软件包中的最新版本(即
npm install eslint --save-dev
等),它安装了以下版本(来自 package.json),这些版本与上述依赖项一致。
"devDependencies": {
"eslint": "^7.25.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0"
}
I had the same problem.我有同样的问题。 My problem was that I had permissions erros when I was installing global packages.
我的问题是我在安装全局包时有权限错误。 First I tried to change the permissions for my node_modules but that didn't worked for me, so I just configured npm to use a different directory.
首先,我尝试更改我的 node_modules 的权限,但这对我不起作用,所以我只是将 npm 配置为使用不同的目录。
Here you can see how you can do that: https://stackoverflow.com/a/55274930在这里您可以看到如何做到这一点: https://stackoverflow.com/a/55274930
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.