Skip to content

Add support for npx #4

Description

@raineorshine

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'
}

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions