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

Running size-limit --version returns undefined #10

Closed
pdehaan opened this issue Aug 8, 2017 · 3 comments
Closed

Running size-limit --version returns undefined #10

pdehaan opened this issue Aug 8, 2017 · 3 comments

Comments

@pdehaan
Copy link
Contributor

pdehaan commented Aug 8, 2017

Steps to reproduce:

  1. Install size-limit as a devDep.
  2. Run $(npm bin)/size-limt --version or create an npm script in package.json.
  3. Run $(npm bin)/size-limt -v alias (or npm script)

Actual results:

$ npm run size:version

> firefox-send@1.0.4 size:version /Users/pdehaan/dev/github/mozilla/something-awesome
> size-limit --version

undefined

Oddly, calling size-limit -v alias fails with a hard error:

$ npm run size:v

> firefox-send@1.0.4 size:v /Users/pdehaan/dev/github/mozilla/something-awesome
> size-limit -v

/Users/pdehaan/dev/github/mozilla/something-awesome/node_modules/size-limit/cli.js:27
  .alias('help', 'h')
   ^

TypeError: yargs.usage(...).option(...).option(...).version(...).help(...).alias is not a function
    at Object.<anonymous> (/Users/pdehaan/dev/github/mozilla/something-awesome/node_modules/size-limit/cli.js:27:4)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:575:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! firefox-send@1.0.4 size:v: `size-limit -v`
npm ERR! Exit status 1
@ai
Copy link
Owner

ai commented Aug 8, 2017

Very strange. Seems like you have some problem in node_modules.

Here is my output:

$ npx size-limit -v
0.8.0

@ai
Copy link
Owner

ai commented Aug 8, 2017

  1. What version of npm/yarn do you use?
  2. Can you try to remove node_modules and install dependencies again?
  3. Can you try ./node_modules/.bin/size-limit -v

@pdehaan
Copy link
Contributor Author

pdehaan commented Aug 8, 2017

Super strange... must have been some version conflict or something in my ./node_modules/. A quick rm -rf node_modules && npm i seems to have fixed it.

$(npm bin)/size-limit -h
/Users/pdehaan/dev/github/mozilla/something-awesome/node_modules/.bin/size-limit

Options:
  --why, -w      Show package content                                  [boolean]
  --version, -v  Show version number                                   [boolean]
  --help, -h     Show help                                             [boolean]

Size Limit will read size-limit section from package.json.
Configurtion example:

  "size-limit": [
    {
      "path": "index.js",
      "limit": "9 KB",
      "babili": true
    }
  ]

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