SocketDev/socket-cli

Can't run on a fresh npm install

Closed this issue · 2 comments

I'm on Ubuntu and tried running socket, unsuccessfully:

$ socket --help
file:///usr/local/lib/node_modules/@socketsecurity/cli/cli.js:18
  await meowWithSubcommands(
  ^^^^^

SyntaxError: Unexpected reserved word
    at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
    at async link (internal/modules/esm/module_job.js:42:21)

Before encountering the error above, I first had to install socket:

# I haven't done anything js-related, so I need npm first
sudo apt-get install npm
sudo npm install -g @socketsecurity/cli

As far as I can tell, the dependencies are there:

$ ll /usr/local/lib/node_modules/@socketsecurity/cli/lib/utils/
drwxr-xr-x 2 root root 4096 Apr  4 10:35 ./
drwxr-xr-x 6 root root 4096 Apr  4 10:35 ../
-rw-r--r-- 1 root root 1275 Apr  4 10:35 api-helpers.js
-rw-r--r-- 1 root root 2810 Apr  4 10:35 chalk-markdown.js
-rw-r--r-- 1 root root  265 Apr  4 10:35 errors.js
-rw-r--r-- 1 root root  882 Apr  4 10:35 flags.js
-rw-r--r-- 1 root root 1768 Apr  4 10:35 format-issues.js
-rw-r--r-- 1 root root 1177 Apr  4 10:35 formatting.js
-rw-r--r-- 1 root root 2113 Apr  4 10:35 meow-with-subcommands.js
-rw-r--r-- 1 root root 1341 Apr  4 10:35 misc.js
-rw-r--r-- 1 root root 4697 Apr  4 10:35 path-resolve.js
-rw-r--r-- 1 root root 1751 Apr  4 10:35 sdk.js
-rw-r--r-- 1 root root  294 Apr  4 10:35 type-helpers.js
-rw-r--r-- 1 root root  421 Apr  4 10:35 update-notifier.js

Environment:

Linux somehost 5.17.0-1020-oem #21-Ubuntu SMP PREEMPT Fri Oct 14 09:33:24 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Perhaps this is a gap in the documentation? Maybe I need to add something to my path?

bmeck commented

What version of node are you running? I know this error would show up if earlier than Node 13.3 which already an End Of Life release of Node but anything newer/currently supported shouldn't have this error.

$ node --version
v12.22.9

Seems to be the cause. Ubuntu and Debian deliver less than the cutting edge..

[focal (20.04LTS)](https://packages.ubuntu.com/focal/nodejs) (web): evented I/O for V8 javascript - runtime executable [universe]
10.19.0~dfsg-3ubuntu1: amd64 arm64 armhf ppc64el s390x
also provided by: [node-pegjs](https://packages.ubuntu.com/focal/node-pegjs)
[jammy (22.04LTS)](https://packages.ubuntu.com/jammy/nodejs) (web): evented I/O for V8 javascript - runtime executable [universe]
12.22.9~dfsg-1ubuntu3: amd64 arm64 armhf ppc64el s390x
[kinetic (22.10)](https://packages.ubuntu.com/kinetic/nodejs) (web): evented I/O for V8 javascript - runtime executable [universe]
18.7.0+dfsg-5ubuntu1: amd64 arm64 armhf ppc64el s390x
[lunar](https://packages.ubuntu.com/lunar/nodejs) (web): evented I/O for V8 javascript - runtime executable [universe]
18.13.0+dfsg1-1ubuntu2: amd64 arm64 armhf ppc64el s390x

I will update locally, feel free to close the issue if you think that workaround is acceptable.