我试图在Ubuntu上安装ES Lint,但遇到了一堆错误,我无法找出错误是什么以及如何修复它们。我用来安装ESlint的命令:
npm init @eslint/config
我正在运行:
- Ubuntu 20.08
- 节点18.13.0
- 国家预防机制8.19.3
下面是我得到的错误列表:
Error: A package.json file is necessary to initialize ESLint. Run `npm init` to create a package.json file and try again.
at promptUser (file:///home/syedfaheem/.npm/_npx/7ef27be80482e586/node_modules/@eslint/create-config/lib/init/config-initializer.js:370:15)
at initializeConfig (file:///home/syedfaheem/.npm/_npx/7ef27be80482e586/node_modules/@eslint/create-config/lib/init/config-initializer.js:586:12)
at file:///home/syedfaheem/.npm/_npx/7ef27be80482e586/node_modules/@eslint/create-config/bin/create-config.js:10:1
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
Node.js v18.13.0
npm ERR! code 1
npm ERR! path /home/syedfaheem
npm ERR! command failed
npm ERR! command sh -c -- create-config
npm ERR! A complete log of this run can be found in:
npm ERR! /home/syedfaheem/.npm/_logs/2023-02-27T05_48_54_008Z-debug-0.log
我不知道错误在哪里,所以我没怎么努力。
1条答案
按热度按时间s3fp2yjn1#
相关错误消息:
初始化ESLint需要package.json文件。请运行
npm init
创建package.json文件,然后重试。首先需要运行
npm init
(不带参数)来创建package.json
:@eslint/配置文档:
注意:
npm init @eslint/config
假设您已经有一个package.json
文件。如果您没有,请确保事先运行npm init
或yarn init
。