This repository has been archived by the owner. It is now read-only.

npx issue on Windows: cannot find module #17869

Open
gyandeeps opened this Issue Jul 20, 2017 · 9 comments

Comments

Projects
None yet
9 participants
@gyandeeps

gyandeeps commented Jul 20, 2017

I'm opening this issue because:

  • npx is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • Other (see below for feature requests):

What's going wrong?

$ npx -v
Command failed: C:\"Program Files"\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js config get cache --parseable
module.js:487
    throw err;
    ^

Error: Cannot find module 'C:\Program'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:575:3

9.2.1

How can the CLI team reproduce the problem?

run the command npx -v on a windows 7/10 machine.

supporting information:

  • npm -v prints: 5.3.0
  • npx -v prints: 9.2.1
  • node -v prints: 8.2.0
  • npm config get registry prints: default
  • Windows, OS X/macOS, or Linux?: Windows 7/10
  • Network issues:
    • Geographic location where npm was run:
    • I use a proxy to connect to the npm registry.
    • I use a proxy to connect to the web.
    • I use a proxy when downloading Git repos.
    • I access the npm registry via a VPN
    • I don't use a proxy, but have limited or unreliable internet access.
  • Container:
    • I develop using Vagrant on Windows.
    • I develop using Vagrant on OS X or Linux.
    • I develop / deploy using Docker.
    • I deploy to a PaaS (Triton, Heroku).

@KenanY KenanY added the npx label Jul 20, 2017

@markvandenbrink

This comment has been minimized.

Show comment
Hide comment
@markvandenbrink

markvandenbrink commented Jul 20, 2017

Probably related to zkat/npx#84.

@csvn

This comment has been minimized.

Show comment
Hide comment
@csvn

csvn Jul 24, 2017

Indeed, this works for me in npx@9.4.1.

If npm@>5.2.0 is installed, the bundled npx@9.2.x might be the one that is used even when you install npx globally. At least this was the case for me on windows. If you still see this issue after global install, check the version with npx -v.

csvn commented Jul 24, 2017

Indeed, this works for me in npx@9.4.1.

If npm@>5.2.0 is installed, the bundled npx@9.2.x might be the one that is used even when you install npx globally. At least this was the case for me on windows. If you still see this issue after global install, check the version with npx -v.

@kyleect

This comment has been minimized.

Show comment
Hide comment
@kyleect

kyleect Jul 28, 2017

@csvn This is happening to me. Is there a way to use 9.4.1 and not 9.2.x?

kyleect commented Jul 28, 2017

@csvn This is happening to me. Is there a way to use 9.4.1 and not 9.2.x?

@csvn

This comment has been minimized.

Show comment
Hide comment
@csvn

csvn Jul 29, 2017

@kyleect One way I found working for me was to remove the C:\Program Files\nodejs\npx and C:\Program Files\nodejs\npx.cmd files. This way the global install of npx is used instead of the one bundled with npm.

csvn commented Jul 29, 2017

@kyleect One way I found working for me was to remove the C:\Program Files\nodejs\npx and C:\Program Files\nodejs\npx.cmd files. This way the global install of npx is used instead of the one bundled with npm.

@rabadiw

This comment has been minimized.

Show comment
Hide comment
@rabadiw

rabadiw Aug 5, 2017

Best practice would argue not to include npx as part of the nodejs install. NPX saves a tone on package management tasks. It should mature on a different cadence then npm and nodejs.

rabadiw commented Aug 5, 2017

Best practice would argue not to include npx as part of the nodejs install. NPX saves a tone on package management tasks. It should mature on a different cadence then npm and nodejs.

@csvn

This comment has been minimized.

Show comment
Hide comment
@csvn

csvn Aug 7, 2017

I think it's fine to bundle npx with npm, as long as a global install of npx takes precedence over the one bundled with npm. I found it very confusing that npx version didn't change after I globally installed it.

csvn commented Aug 7, 2017

I think it's fine to bundle npx with npm, as long as a global install of npx takes precedence over the one bundled with npm. I found it very confusing that npx version didn't change after I globally installed it.

@somombo

This comment has been minimized.

Show comment
Hide comment
@somombo

somombo Aug 9, 2017

I got it to work...

I looked in "C:\Program Files\nodejs\node_modules\npm\package.json" and changed the dependency "libnpx": "~9.2.0", to "libnpx": "^9.2.0",. Then run npm update in the above directory and it all works fine now i.e. npx -v successfully gives me 9.5.0 with no errors.

@zkat Would you consider bumping up npm's libnpx dependency to version ~9.5.0 or ^9.2.0?

somombo commented Aug 9, 2017

I got it to work...

I looked in "C:\Program Files\nodejs\node_modules\npm\package.json" and changed the dependency "libnpx": "~9.2.0", to "libnpx": "^9.2.0",. Then run npm update in the above directory and it all works fine now i.e. npx -v successfully gives me 9.5.0 with no errors.

@zkat Would you consider bumping up npm's libnpx dependency to version ~9.5.0 or ^9.2.0?

@michaeljota

This comment has been minimized.

Show comment
Hide comment
@michaeljota

michaeljota Aug 14, 2017

If the package in npm it's updated for next release, and it gets bundle with node, would that do the work?

michaeljota commented Aug 14, 2017

If the package in npm it's updated for next release, and it gets bundle with node, would that do the work?

@StanleyFestus

This comment has been minimized.

Show comment
Hide comment
@StanleyFestus

StanleyFestus Jan 22, 2018

npx -v throws an error

StanleyFestus commented Jan 22, 2018

npx -v throws an error

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.