SocketDev / SocketDev/socket-cli

socket npm cannot execute npm installed via mise

Open
#946 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
317
Forks
65
Avg merge
1h 26m
Merged PRs (30d)
30

Description

mise puts node and npm file pointing like ~/.local/share/mise/installs/node/22.21.1/bin/npm
which is a shell script :(

#!/usr/bin/env bash
set -euo pipefail

# This script wraps npm so to run `mise reshim` after global installs and uninstalls
# Any other cases are passed-through to npm

this_dir=$(dirname "${BASH_SOURCE[0]}")
plugin_name=$(basename "$(dirname "$this_dir")")

this_dir=$(cd "$this_dir" && pwd -P) # Normalizes the directory
...

So socket npm fails because it isn't a node script.

$ socket npm i
   _____         _       _        /---------------
  |   __|___ ___| |_ ___| |_      | CLI: v1.1.38
  |__   | . |  _| '_| -_|  _|     | token: (not set), org: (not set)
  |_____|___|___|_,_|___|_|.dev   | Command: `socket npm`, cwd: **

/Users/kesoji/.local/share/mise/installs/node/22.21.1/bin/npm:2
set -euo pipefail
         ^^^^^^^^

SyntaxError: Unexpected identifier 'pipefail'
    at wrapSafe (node:internal/modules/cjs/loader:1638:18)
    at Module._compile (node:internal/modules/cjs/loader:1680:20)
    at Object..js (node:internal/modules/cjs/loader:1839:10)
    at Module.load (node:internal/modules/cjs/loader:1441:32)
    at Function._load (node:internal/modules/cjs/loader:1263:12)
    at TracingChannel.traceSync (node:diagnostics_channel:328:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
    at node:internal/main/run_main_module:36:49

Node.js v22.21.1

Is there any solution or workaround?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the socket npm command entry point and reproduce the failure with the mise-generated ~/.local/share/mise/installs/node/22.21.1/bin/npm wrapper. Trace how the CLI launches the requested executable, then verify that shell-script npm wrappers are handled without Node parsing them as JavaScript. The issue names no repository file or test, so completion should include a regression check for this invocation.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.