ErdemOzgen / DevSecOpsBuilder

Automatic DevSecOps builder
GNU General Public License v3.0
7 stars 2 forks source link

Error: A package.json file is necessary to initialize ESLint. #7

Closed ataseren closed 10 months ago

ataseren commented 11 months ago

Received this error during ESLint installation:

Installing eslint...
Need to install the following packages:
  @eslint/create-config
Ok to proceed? (y) y
file:///home/aseren/.npm/_npx/7ef27be80482e586/node_modules/@eslint/create-config/lib/init/config-initializer.js:400
        throw new Error("A package.json file is necessary to initialize ESLint. Run `npm init` to create a package.json file and try again.");
              ^

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/aseren/.npm/_npx/7ef27be80482e586/node_modules/@eslint/create-config/lib/init/config-initializer.js:400:15)
    at initializeConfig (file:///home/aseren/.npm/_npx/7ef27be80482e586/node_modules/@eslint/create-config/lib/init/config-initializer.js:616:12)
    at file:///home/aseren/.npm/_npx/7ef27be80482e586/node_modules/@eslint/create-config/bin/create-config.js:10:1
    at ModuleJob.run (internal/modules/esm/module_job.js:145:37)
    at async Loader.import (internal/modules/esm/loader.js:182:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5)
npm ERR! code 1
npm ERR! path /home/aseren/Desktop/DevSecOpsBuilder
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/aseren/.npm/_logs/2023-11-29T09_54_33_343Z-debug-0.log
Traceback (most recent call last):
  File "/home/aseren/Desktop/DevSecOpsBuilder/devsecopsbuilder/pipeline_executer.py", line 30, in install_tools
    subprocess.run(help_command, shell=True, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
  File "/home/aseren/anaconda3/envs/redscan/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'eslint --help' returned non-zero exit status 127.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/aseren/Desktop/DevSecOpsBuilder/main.py", line 87, in <module>
    main()
  File "/home/aseren/Desktop/DevSecOpsBuilder/main.py", line 52, in main
    pipeline_executer.install_tools(default_tools)
  File "/home/aseren/Desktop/DevSecOpsBuilder/devsecopsbuilder/pipeline_executer.py", line 35, in install_tools
    subprocess.run(install_command, shell=True, check=True)
  File "/home/aseren/anaconda3/envs/redscan/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'npm init @eslint/config' returned non-zero exit status 1.