Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Error: The system cannot find the path specified #703

Closed
3 tasks done
9812334 opened this issue Jul 19, 2020 · 11 comments
Closed
3 tasks done

[Windows] Error: The system cannot find the path specified #703

9812334 opened this issue Jul 19, 2020 · 11 comments
Labels

Comments

@9812334
Copy link

9812334 commented Jul 19, 2020

  • I have searched for similar issues
  • I am using the latest version of npm-check-updates
  • I am using node >= 10.17

Steps to Reproduce

$ ncu -u

C:\Users\test\AppData\Roaming\npm\node_modules\npm-check-updates\lib\npm-check-updates.js:427
throw err
^
The system cannot find the path specified.
The system cannot find the path specified.

(Use node --trace-uncaught ... to show where the exception was thrown)

I just re-installed the latest node and I still get this error.

Any help is appreciated. Thanks

@raineorshine
Copy link
Owner

Yes, interesting that there isn't a stack trace. What do you get with ncu --loglevel verbose?

It might be having trouble finding your package.json, as it seems it's not getting that far.

@raineorshine raineorshine changed the title error thrown Error: The system cannot find the path specified Jul 20, 2020
@raineorshine
Copy link
Owner

@9812334 Any update?

@mborecki
Copy link

mborecki commented Aug 6, 2020

I have this problem for a couple mounts.

Trace stack shows only this:

$ node --trace-uncaught /c/Users/Marek/AppData/Roaming/npm/node_modules/npm-check-updates/bin/ncu.js

C:\Users\Marek\AppData\Roaming\npm\node_modules\npm-check-updates\lib\npm-check-updates.js:427
  throw err
  ^
System nie mo�e odnale�� okre�lonej �cie�ki.
System nie mo�e odnale�� okre�lonej �cie�ki.

Thrown at:
    at C:\Users\Marek\AppData\Roaming\npm\node_modules\npm-check-updates\lib\npm-check-updates.js:427:3
    at emit (events.js:311:20)
    at processPromiseRejections (internal/process/promises.js:209:33)
    at processTicksAndRejections (internal/process/task_queues.js:98:32)

@raineorshine
Copy link
Owner

@mborecki What do you get with ncu --loglevel verbose?

@mborecki
Copy link

mborecki commented Aug 6, 2020

$ node --trace-uncaught /c/Users/Marek/AppData/Roaming/npm/node_modules/npm-che
ck-updates/bin/ncu --loglevel verbose
Initializing...

C:\Users\Marek\AppData\Roaming\npm\node_modules\npm-check-updates\lib\npm-check-updates.js:427
  throw err
  ^
System nie mo�e odnale�� okre�lonej �cie�ki.
System nie mo�e odnale�� okre�lonej �cie�ki.

Thrown at:
    at C:\Users\Marek\AppData\Roaming\npm\node_modules\npm-check-updates\lib\npm-check-updates.js:427:3
    at emit (events.js:311:20)
    at processPromiseRejections (internal/process/promises.js:209:33)
    at processTicksAndRejections (internal/process/task_queues.js:98:32)

BUT
after some debugging and testing I pinpointed problem to this line:

npm-check-updates\lib\npm-check-updates.js:448

  if (options.packageManager === 'npm' && !options.prefix) {
    options.prefix = await packageManagers.npm.defaultPrefix(options)
  }

If I surround defaultPrefix in try..catch ncu works fine for me.

@raineorshine
Copy link
Owner

BUT
after some debugging and testing I pinpointed problem to this line:

npm-check-updates\lib\npm-check-updates.js:448

  if (options.packageManager === 'npm' && !options.prefix) {
    options.prefix = await packageManagers.npm.defaultPrefix(options)
  }

If I surround defaultPrefix in try..catch ncu works fine for me.

Brilliant! That's super helpful. Would you be willing to find what is failing in defaultPrefix? Does cmd = 'npm' work but not cmd = 'npm.cmd'? Maybe npm.cmd is not always correct on Windows.

This could be a regression from the fix for #146.

@mborecki
Copy link

mborecki commented Aug 6, 2020

cmd = 'npm' throws spawn npm ENOENT so this is no a fix.

That is what I figured out:

file: npm-check-updates\lib\package-managers\npm.js#185

return spawn(cmd, ['config', 'get', 'prefix']).then(prefix => {

if I add option {shell: true} so...

return spawn(cmd, ['config', 'get', 'prefix'], {shell: true}).then(prefix => {

it works.

Unfortunately I dont realy know consequences (especially on no Win10) of this change, so I will not making PR.

My evn:
Win10
Node: 12.16.1
npm: 6.14.2
ncu: 7.0.3

@raineorshine
Copy link
Owner

Thanks! I will add the try-catch to avoid any regressions and leave a note to this issue in case someone comes along with a better understanding of the implications. Thanks again for your help!

@raineorshine raineorshine changed the title Error: The system cannot find the path specified [Windows] Error: The system cannot find the path specified Aug 6, 2020
@raineorshine
Copy link
Owner

Published to v7.0.4-alpha.1. Will you see if this works?

npm install -g npm-check-updates@next

@mborecki
Copy link

mborecki commented Aug 7, 2020

@raineorshine
Do not works for me because I don't have english OS and my error is: System nie mo�e odnale�� okre�lonej �cie�ki. - the same but in polish.

@raineorshine
Copy link
Owner

That makes sense. Will you try now? I removed the error text detection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants