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

Getting SyntaxError: Unexpected token '.' during npkill launch #141

Closed
sourabhbagrecha opened this issue Jan 28, 2023 · 3 comments
Closed

Comments

@sourabhbagrecha
Copy link

Describe the bug
Just did a fresh install for the first time on my MacOS, and the installation went fine. But once I launch the process, it fails with the following error

node_modules/npkill/lib/services/files.service.js:37
        return sorted[0]?.modificationTime || null;

SyntaxError: Unexpected token '.'

Even npkill -v is causing the same issue.

To Reproduce
Steps to reproduce the behavior:

  1. Install npkill using npm i -g npkill
  2. Execute: npkill

Or just npx npkill is also returning the same issue.

Expected behavior
I was expecting it to start listing down all the node_modules folders with their size.

Screenshots
image

  • OS: MacOS Monterey v12.5 M1 Pro
  • Version 0.10.0
@zaldih
Copy link
Member

zaldih commented Jan 28, 2023

Hey! Thank you very much for opening this issue.

Could you confirm which version of node you have?

If your node version is <14 then npkill will not work and you can use launch a old version with npkill@0.8.3.

Otherwise it will indeed be a bug.

@sourabhbagrecha
Copy link
Author

Hey @zaldih, I switched to v14 and it worked! Thank you.
Can we add a warning in place when users try to execute it from a lower than supported version?
It will save a lot of time. Thanks.

@zaldih
Copy link
Member

zaldih commented Mar 5, 2023

It would be a good idea but, how could we do it?

The error appears as soon as the import(main) function appears in main.js and before main is imported no code execution can be done.

One way I have thought of is to run an intermediate script that does the check and then executes the program but it is an additional complexity that I would not like to add.

So I think it's best to leave it like this. There are already formal warnings in both the readme and the package.json (engines section).

If you have another idea in mind I would like to hear it!

@zaldih zaldih closed this as completed Mar 12, 2023
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