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

Add support for npx #4

Open
raineorshine opened this issue Feb 22, 2021 · 2 comments
Open

Add support for npx #4

raineorshine opened this issue Feb 22, 2021 · 2 comments

Comments

@raineorshine
Copy link

It would be great if this library worked with not just local modules but also npx.

Steps to Reproduce

npx run-func parse-github-url default https://github.com/magic-akari/page-lifecycle

Current Behavior

% npx run-func parse-github-url default https://github.com/magic-akari/page-lifecycle                    ✗
internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module '/private/tmp/temp/parse-github-url'
Require stack:
- /Users/raine/.npm/_npx/1aedd964be30f5cd/node_modules/run-func/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/raine/.npm/_npx/1aedd964be30f5cd/node_modules/run-func/index.js:15:20)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/raine/.npm/_npx/1aedd964be30f5cd/node_modules/run-func/index.js'
  ]
}
npm ERR! code 1
npm ERR! path /private/tmp/temp
npm ERR! command failed
npm ERR! command sh -c run-func "parse-github-url" "default" "https://github.com/magic-akari/page-lifecycle"

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/raine/.npm/_logs/2021-02-22T18_12_47_304Z-debug.log

Expected Behavior

Url {
  protocol: 'https:',
  slashes: true,
  auth: null,
  host: 'github.com',
  port: null,
  hostname: 'github.com',
  hash: null,
  search: null,
  query: null,
  pathname: 'magic-akari/page-lifecycle',
  path: 'magic-akari/page-lifecycle',
  href: 'https://github.com/magic-akari/page-lifecycle',
  filepath: null,
  owner: 'magic-akari',
  name: 'page-lifecycle',
  repo: 'magic-akari/page-lifecycle',
  branch: 'master',
  repository: 'magic-akari/page-lifecycle'
}
@DVLP
Copy link
Owner

DVLP commented Feb 2, 2022

Modules like parse-github-url should work directly with npx instead. I'll keep this issue open in case of more interest in such functionality

@DVLP
Copy link
Owner

DVLP commented Feb 28, 2022

I published initial support for npm modules in V3. They must be installed as dependencies as remote modules are out of scope of run-func.

If i.e. parse-github-url is in dependencies then a script run-func parse-github-url default https://github.com/magic-akari/page-lifecycle should work
btw parse-github-url works directly in npx as it should npx parse-github-url https://github.com/magic-akari/page-lifecycle

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

No branches or pull requests

2 participants