Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

npx throw exception "Cannot find module 'C:\Program'" on windows #101

Closed
JonasGao opened this issue Jul 22, 2017 · 4 comments
Closed

npx throw exception "Cannot find module 'C:\Program'" on windows #101

JonasGao opened this issue Jul 22, 2017 · 4 comments

Comments

@JonasGao
Copy link

my step:

  1. create dir 'export' on desktop
  2. start cmd & cd to 'export'
  3. run npx http-server ./

exception throwed

capture

env info

C:\Users\gaopi\Desktop\export>node -v
v8.2.1

C:\Users\gaopi\Desktop\export>npm -v
5.3.0

C:\Users\gaopi\Desktop\export>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

C:\Users\gaopi\Desktop\export>
@JonasGao
Copy link
Author

JonasGao commented Jul 22, 2017

maybe, it is not an issue of npx.... i m not sure....

i think, if i install http-server local, maybe npx can run it.... but....

C:\Users\gaopi\Desktop\export>npm i http-server
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\gaopi\Desktop\export\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\gaopi\Desktop\export\package.json'
npm WARN export No description
npm WARN export No repository field.
npm WARN export No README data
npm WARN export No license field.

+ http-server@0.10.0
added 23 packages in 6.352s

C:\Users\gaopi\Desktop\export>npx http-server ./
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

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


C:\Users\gaopi\Desktop\export>

@JonasGao
Copy link
Author

i think the problem is here https://github.com/zkat/npx/blob/latest/index.js#L205

@AvailCat
Copy link

duplicate #84

@JonasGao
Copy link
Author

JonasGao commented Jul 22, 2017

ok, get it, lets go to #84

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

No branches or pull requests

2 participants