You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When auditjs runs, it detects what kind of package it's in. For NPM, it does that by checking to see if there's an npm_modules folder. However, you run auditjs from a monorepo sub-package, that sub-package may not have a node_modules folder.
To Reproduce
Steps to reproduce the behavior:
Create a monorepo with a folder structure like this:
/root/
/root/package.json
/root/package-lock.json
/root/node_modules/
/root/packages/my-subpackage/package.json
/root/packages/my-subpackage/package-lock.json
/root/packages/my-subpackage/custom-whitelist.json
Expected behavior
I expect that auditjs will successfully detect that this is an npm package, since there is a package-lock.json file.
Instead, you get an error:
AuditJS version: 4.0.45
√ Starting application
[2024-10-28T10:08:39.535] [ERROR] auditjs - Failed project directory validation. Are you in a (built) node, yarn, or bower project directory?
Error: Could not instantiate muncher
at new Application (C:...\AppData\Local\npm-cache_npx\9fdf97b2057c04c8\node_modules\auditjs\bin\Application\Application.js:72:19)
at Object. (C:...\AppData\Local\npm-cache_npx\9fdf97b2057c04c8\node_modules\auditjs\bin\index.js:206:23)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49
Desktop (please complete the following information):
Describe the bug
When auditjs runs, it detects what kind of package it's in. For NPM, it does that by checking to see if there's an
npm_modules
folder. However, you run auditjs from a monorepo sub-package, that sub-package may not have anode_modules
folder.To Reproduce
Steps to reproduce the behavior:
/root/
/root/package.json
/root/package-lock.json
/root/node_modules/
/root/packages/my-subpackage/package.json
/root/packages/my-subpackage/package-lock.json
/root/packages/my-subpackage/custom-whitelist.json
cd root/packages/my-subpackage
npx auditjs ossi --whitelist custom-whitelist.json
Expected behavior
I expect that auditjs will successfully detect that this is an npm package, since there is a package-lock.json file.
Instead, you get an error:
AuditJS version: 4.0.45
√ Starting application
[2024-10-28T10:08:39.535] [ERROR] auditjs - Failed project directory validation. Are you in a (built) node, yarn, or bower project directory?
Error: Could not instantiate muncher
at new Application (C:...\AppData\Local\npm-cache_npx\9fdf97b2057c04c8\node_modules\auditjs\bin\Application\Application.js:72:19)
at Object. (C:...\AppData\Local\npm-cache_npx\9fdf97b2057c04c8\node_modules\auditjs\bin\index.js:206:23)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49
Desktop (please complete the following information):
Additional context
Code flow is:
node_modules
folderProposal
This could be addressed in a few different ways:
--root
flag, that points to where the node_modules go. If auditjs must process anode_modules
folder, I believe this is the best answer.--bower
flag, provide a--npm
flag that just forces into the NPM mode.I am open to contributing this change. Please advise if you are interested, and which change you'd prefer.
cc @bhamail / @DarthHater / @allenhsieh / @Slim-Shary
The text was updated successfully, but these errors were encountered: