fabric8-analytics-vscode-extension
fabric8-analytics-vscode-extension copied to clipboard
Analysis for Package.json return ENOENT error [BUG]
[BUG] I am in my project (React-nodejs) directory and I right click the package.json to trigger the redhat dependency analysis.
I receive the error:
Command failed: npm i --package-lock-only --prefix c:\Users\path\to\project npm ERR! code ENOENT npm ERR! syscall open npm ERR! path C:\Program Files\Microsoft VS Code/package.json npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, open 'C:\Program Files\Microsoft VS Code\package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: C:\Users\username\AppData\Local\npm-cache_logs\2023-11-14T02_53_58_882Z-debug-0.log
and on the generated HTML document I receive the following:
Unable to analyze your stack.
I saw that its trying to find the package.json in directory
C:\Program Files\Microsoft VS Code\package.json
which is not my project directory.
To Reproduce Steps to reproduce the behavior:
- On VSCODE install Redhat Dependency analytics plugin
- Go to your project directory
- Right click on package.json
- Click on 'Red hat dependency analystics report ...'
- Wait for it to generate the report
- See error in vscode notifications and the generated report
Expected behavior It should use the package.json in the project directory and analyse the dependencies and generate the correct report.
Logs
The log file generated is:
0 verbose cli C:\Users\username\Documents\dev_tools\node-v18.17.0-win-x64\node.exe C:\Users\username\Documents\dev_tools\node-v18.17.0-win-x64\node_modules\npm\bin\npm-cli.js
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 2ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Users\username\Documents\dev_tools\node-v18.17.0-win-x64\node_modules\npm\npmrc Completed in 3ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 3ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:c:\Users\username\Documents\path\to\project\.npmrc Completed in 0ms
10 timing config:load:project Completed in 0ms
11 timing config:load:file:C:\Users\username\.npmrc Completed in 2ms
12 timing config:load:user Completed in 2ms
13 timing config:load:file:c:\Users\username\Documents\path\to\project\etc\npmrc Completed in 1ms
14 timing config:load:global Completed in 1ms
15 timing config:load:setEnvs Completed in 0ms
16 timing config:load Completed in 13ms
17 timing npm:load:configload Completed in 14ms
18 timing config:load:flatten Completed in 3ms
19 timing npm:load:mkdirpcache Completed in 0ms
20 timing npm:load:mkdirplogs Completed in 1ms
21 verbose title npm i
22 verbose argv "i" "--package-lock-only" "--prefix" "c:\\Users\\username\\Documents\\path\\to\\project"
23 timing npm:load:setTitle Completed in 1ms
24 timing npm:load:display Completed in 1ms
25 verbose logfile logs-max:10 dir:C:\Users\username\AppData\Local\npm-cache\_logs\2023-11-14T02_59_45_176Z-
26 verbose logfile C:\Users\username\AppData\Local\npm-cache\_logs\2023-11-14T02_59_45_176Z-debug-0.log
27 timing npm:load:logFile Completed in 8ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 67ms
31 timing arborist:ctor Completed in 0ms
32 silly logfile start cleaning logs, removing 2 files
33 timing idealTree:init Completed in 1355ms
34 timing idealTree Completed in 1359ms
35 timing command:i Completed in 1361ms
36 verbose stack Error: ENOENT: no such file or directory, open 'C:\Program Files\Microsoft VS Code\package.json'
37 verbose cwd C:\Program Files\Microsoft VS Code
38 verbose Windows_NT 10.0.19045
39 verbose node v18.17.0
40 verbose npm v10.1.0
41 error code ENOENT
42 error syscall open
43 error path C:\Program Files\Microsoft VS Code/package.json
44 error errno -4058
45 error enoent ENOENT: no such file or directory, open 'C:\Program Files\Microsoft VS Code\package.json'
46 error enoent This is related to npm not being able to find a file.
46 error enoent
47 verbose exit -4058
48 timing npm Completed in 1814ms
49 verbose unfinished npm timer reify 1699930785626
50 verbose unfinished npm timer reify:loadTrees 1699930785626
51 verbose unfinished npm timer idealTree:userRequests 1699930786983
52 verbose code -4058
53 error A complete log of this run can be found in: C:\Users\username\AppData\Local\npm-cache\_logs\2023-11-14T02_59_45_176Z-debug-0.log
[Project Structure]
- project [folder]
-- src
-- package.json
-- node_modules
-- package-lock.json
VSCode(please complete the following information):
- OS: [Windows 10 22H2]
- VSCode version [1.80.1]
- Dependency Analytics Version [0.7.3]
- Node version [v18.17.0]
- npm version [v10.1.0]
CHE7/Theia(please complete the following information):
- OS: [Windows 10 22H2]
- Browser [Seeing report in vscode editor]
- CHE/Theia version [Don't nkow]
- Dependency Analytics Version [0.7.3]
Additional context I have already tried deleting the node modules, package-lock.json and clean the cache and reinstall the node modules. Also there is no npmrc file in my project structure.