Skip to content

socket npm cannot execute npm installed via mise #946

@kesoji

Description

@kesoji

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions