bug: `Error: spawn ... snyk ENOENT`
Closed this issue · 0 comments
asos-craigmorten commented
Issue
Details
When using npx @asos/snyker
and snyk
or @asos/snyker
hasn't been globally installed you get the following error:
$ npx @asos/snyker
Need to install the following packages:
@asos/snyker
Ok to proceed? (y) y
[SNYKER: STARTING]
[SNYKER: STEP 1]: Ensuring lockfile 'yarn.lock' is up to date.
yarn install v1.22.15
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 0.21s.
[SNYKER: STEP 2]: Deleting '.snyk' file.
[SNYKER: STEP 3]: Getting vulnerable paths from Snyk.
An error was thrown while executing the previous command.
{
error: Error: spawn /root/.npm/_npx/41eaf48ba153073a/node_modules/@asos/snyker/node_modules/.bin/snyk ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn /root/.npm/_npx/41eaf48ba153073a/node_modules/@asos/snyker/node_modules/.bin/snyk',
path: '/root/.npm/_npx/41eaf48ba153073a/node_modules/@asos/snyker/node_modules/.bin/snyk',
spawnargs: [
'test',
'--dev',
'--json',
'--ignore-policy',
'--strict-out-of-sync=true',
'--file=yarn.lock',
'--prune-repeated-dependencies'
]
}
}
Retrying...
An error was thrown while executing the previous command.
{
error: Error: spawn /root/.npm/_npx/41eaf48ba153073a/node_modules/@asos/snyker/node_modules/.bin/snyk ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn /root/.npm/_npx/41eaf48ba153073a/node_modules/@asos/snyker/node_modules/.bin/snyk',
path: '/root/.npm/_npx/41eaf48ba153073a/node_modules/@asos/snyker/node_modules/.bin/snyk',
spawnargs: [
'test',
'--dev',
'--json',
'--ignore-policy',
'--strict-out-of-sync=true',
'--file=yarn.lock',
'--prune-repeated-dependencies'
]
}
}
Exiting...
This is as a result of the hardcorded path to the snyk
binary, which is incorrect in npx
contexts.