Npm-check-updates: Error: spawn npm ENOENT (Windows)

Created on 7 Mar 2019  Â·  24Comments  Â·  Source: raineorshine/npm-check-updates

  • [x] I have read the list of known issues before filing this issue.
  • [x] I have searched for similiar issues before filing this issue.

  • node version: v10.13.0

  • npm version: 6.4.1
  • npm-check-updates version: 3.0.0

Hi, I updated to 3.0.0 on Windows 10 and get this error now:

ncu
internal/modules/cjs/loader.js:582
    throw err;
    ^

Error: Cannot find module 'spawn-please'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (C:\Users\lmach\AppData\Roaming\npm\node_modules\npm-check-updates\lib\package-managers\npm.js:6:22)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (C:\Users\lmach\AppData\Roaming\npm\node_modules\npm-check-updates\lib\package-managers\index.js:4:10)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)

A wild guess is that spawn-please is a dev-dependency, but required in production?

Thank you

bug

Most helpful comment

@stoically Thank you!

Published to v3.0.2. Does this work now?

All 24 comments

can confrm :) our CI just broke due to version not locked

Does not work locally either:

 ~/Desktop/projects/-system  feature/activation-from-drawer ? ⍟5  npm install -g npm-check-updates                                                                          ✓  10025  18:02:40
/Users/sebastienlorber/.nvm/versions/node/v8.11.3/bin/npm-check-updates -> /Users/sebastienlorber/.nvm/versions/node/v8.11.3/lib/node_modules/npm-check-updates/bin/npm-check-updates
/Users/sebastienlorber/.nvm/versions/node/v8.11.3/bin/ncu -> /Users/sebastienlorber/.nvm/versions/node/v8.11.3/lib/node_modules/npm-check-updates/bin/ncu
+ [email protected]
added 116 packages in 14.477s



 ~/Desktop/projects/-system  feature/activation-from-drawer ? ⍟5  ncu                                                                                                       ✓  10026  18:03:00
module.js:549
    throw err;
    ^

Error: Cannot find module 'spawn-please'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/sebastienlorber/.nvm/versions/node/v8.11.3/lib/node_modules/npm-check-updates/lib/package-managers/npm.js:6:22)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/sebastienlorber/.nvm/versions/node/v8.11.3/lib/node_modules/npm-check-updates/lib/package-managers/index.js:4:10)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)



 ~/Desktop/projects/-system  feature/activation-from-drawer ? ⍟5  node -v                                                                                                 1 ↵  10027  18:03:02
v8.11.3

On it, thanks!

Moved spawn-please to dependencies. Try v3.0.1.

muc better now i just need to update deps :D

updated to 3.0.1 now getting

Unhandled rejection Error: spawn npm ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:246:19) at onErrorNT (internal/child_process.js:427:16) at processTicksAndRejections (internal/process/next_tick.js:76:17) at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:51:3) at Function.Module.runMain (internal/modules/cjs/loader.js:804:11) at internal/main/run_main_module.js:21:11

Any ideas? It is erroring out as it tries to spawn npm in a child process in order to fetch versions.

I am not able to reproduce.

hmm, could be I upgraded npm to v6.9 earlier?

I have the same problem with ncu 3.0.1, node v11.11.0 and npm v6.7.0.

I downgraded to npm v6.7.0 as well and still same error...I'm on node v11.10.1

It works when using in Linux, but not on Windows, may that help.
https://github.com/tjunnone/npm-check-updates/blob/master/lib/package-managers/npm.js#L59

could it be a path issue finding npm on windows? I use npm-windows-upgrade and it reports that the shell reports that npm resides in "C:/Program Files/nodejs" while npm itself reports "C:/Users/Terry/Appdata/Roaming/npm" (where the global packages are)

I can also confirm error on Windows.

Same error here

Unhandled rejection Error: spawn npm ENOENT
    at _errnoException (util.js:1022:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Working on getting a Windows build on Travis CI so I can troubleshoot. Any other helpful information from people on Windows is greatly appreciated.

I have the same problem in windows

Travis support for Windows appears to be failing right now. I'll need someone actually on a Windows machine to do some deeper troubleshooting if possible.

The npm command is hard-coded here. On windows it needs to be npm.cmd and thus a check like here would likely be needed.

@stoically Thank you!

Published to v3.0.2. Does this work now?

Fixed the issue for me.

I was literally just installing this package, got the same error and checked its issues to see that it got fixed one minute ago. Updating to 3.0.2 fixed it for me, too!

Updated to 3.0.2 after this error and now... after a while (while trying to get the updates) the console gets stuck every time I run ncu (using Windows 10 from Git Bash, Command or PowerShell, all stuck).

@mhosman This sounds like a known issue with stdin on Windows. Can you try specifying an explicit --packageFile?

@raineorshine That's not the problem. The console is crashing running ncu and also running ncu --loglevel verbose --packageFile package.json. The console gets stuck in "Fetching latest versions..." and after a while, crashes (this behaviour is only available with 3.0.2 version).

@mhosman Okay, must be something else. I created #488 to track. Hopefully someone else who can reproduce is able to troubleshoot. Thank you!

Was this page helpful?
0 / 5 - 0 ratings