Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@freestyle-sh/with-nodejs

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@freestyle-sh/with-nodejs

Node.js runtime via [NVM](https://github.com/nvm-sh/nvm) for [Freestyle](https://freestyle.sh) VMs.

npmnpm
Version
0.2.8
Version published
Weekly downloads
424
-83.29%
Maintainers
2
Weekly downloads
 
Created
Source

@freestyle-sh/with-nodejs

Node.js runtime via NVM for Freestyle VMs.

Installation

npm install @freestyle-sh/with-nodejs freestyle-sandboxes

Usage

import { freestyle } from "freestyle-sandboxes";
import { VmNodeJs } from "@freestyle-sh/with-nodejs";

const { vm } = await freestyle.vms.create({
  with: {
    node: new VmNodeJs(),
  },
});

const res = await vm.node.runCode({
  code: "console.log(JSON.stringify({ hello: 'world' }));"
});

console.log(res);
// { result: { hello: 'world' }, stdout: '{"hello":"world"}\n', statusCode: 0 }

Options

new VmNodeJs({
  version: "22", // Optional: Node.js version (default: "24")
})
OptionTypeDefaultDescription
versionstring"24"Node.js version to install via NVM.

API

vm.node.runCode({ code: string })

Executes JavaScript code in the Node.js runtime.

Returns: Promise<RunCodeResponse>

type RunCodeResponse<Result> = {
  result: Result;      // Parsed JSON from stdout (if valid JSON)
  stdout?: string;     // Raw stdout output
  stderr?: string;     // Raw stderr output
  statusCode?: number; // Exit code
};

vm.node.install(options?)

Installs npm packages.

// Install from package.json in current directory
await vm.node.install();

// Install from package.json in specific directory
await vm.node.install({ directory: "/app" });

// Install specific packages
await vm.node.install({ deps: ["lodash", "express"] });

// Install with specific versions
await vm.node.install({ deps: { "lodash": "^4.0.0", "express": "~5.0.0" } });

// Install as dev dependencies
await vm.node.install({ deps: ["typescript"], dev: true });

// Install globally
await vm.node.install({ global: true, deps: ["typescript"] });

Returns: Promise<InstallResult>

type InstallResult = {
  success: boolean;
  stdout?: string;
  stderr?: string;
};

Documentation

FAQs

Package last updated on 20 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts