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

Doesn't work on PopOS. "specify the name in Command constructor or using .name()" #1496

Open
sgehrman opened this issue Feb 4, 2025 · 3 comments

Comments

@sgehrman
Copy link

sgehrman commented Feb 4, 2025

Fresh install of npm, nodejs on fresh install of PopOS (latest)

tried npx method and installing ncu. both fail

$ node --version
v12.22.9
$ npm --version
8.5.1

$ ncu
/usr/local/lib/node_modules/npm-check-updates/build/cli.js:12

  • specify the name in Command constructor or using .name());return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new Ce(e,t)}argument(e,t,i,n){const r=this.createArgument(e,t);return typeof i=="function"?r.default(n).argParser(i):r.default(i),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){const t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(only the last argument can be variadic '${t.name()}');if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(a default value for a required argument is never used: '${e.name()}');return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";const[,i,n]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",s=this.createCommand(i);return s.helpOption(!1),n&&s.arguments(n),r&&s.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=s,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){const i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw new Error(Unexpected value for event passed to hook : '${e}'.
    ^

SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47

@raineorshine
Copy link
Owner

Hi, thanks for the report.

I would suggest filing this with PopOS. npm-check-updates works fine with other Linux distros, and if PopOS is handling something in a non-standard way, that should probably be fixed at the OS level.

If there is an easy workaround that can be added in npm-check-updates to make it work on PopOS, I'm open to it, but the PR would be up to you. Thanks.

@sgehrman
Copy link
Author

sgehrman commented Feb 4, 2025

I doubt it's popOs's fault. I just mentioned this for more info. You have no idea why looking at the error?

@raineorshine
Copy link
Owner

raineorshine commented Feb 4, 2025

I see now that you are using node v12.22.9, which reached end-of-life status on 2022-04-30.

npm-check-updates requires node ^18.18.0 || >=20.0.0

If you can't upgrade your node version, the last version of npm-check-updates that supports node v12 is npm-check-updates v12.x, though it is four years old at this point. (It's a coincidence that they are the same major version number.)

I was distracted by the PopOS bit :)

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

No branches or pull requests

2 participants