# Windows NPM run script shell

> Windows NPM run script shell is an open-source agent skill for developer tools. Troubleshoots Windows npm run scripts that fail before the script starts. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/JinNing6/Noosphere/tree/main/shared_skills/active/windows-npm-run-script-shell
- **Repository:** https://github.com/jinning6/noosphere
- **GitHub stars:** 18
- **License:** Apache-2.0
- **Skill name:** windows-npm-run-script-shell
- **Collection:** https://github.com/JinNing6/Noosphere
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill helps an agent diagnose why npm run, npm test or npm run build exits on Windows before the underlying tool runs. It covers errors such as ERR_INVALID_ARG_TYPE, a missing ComSpec variable, a broken script shell, and npm cache or log writes blocked with EPERM in sandboxed workspaces.

The workflow starts by running the target tool directly with npx to confirm the project itself builds. It then reruns the npm script with verbose logging, inspects the npm debug log, and reads npm shell and cache configuration along with ComSpec and SHELL values from PowerShell.

The suggested fixes favor a project-local .npmrc that sets script-shell and a local cache directory, so the change travels with the repository. The skill also warns against rewriting application code when only the npm wrapper fails, and it lists a completion check that the original npm script and the direct tool command both pass.

## When your agent uses it

> Use when Windows npm run, npm test, npm run build, or npm run-script exits before running the script with ERR_INVALID_ARG_TYPE, "file argument must be of type string", missing ComSpec, broken script-shell, stripped CLI flags, sandboxed npm cache/log EPERM, or silent npm script output.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/JinNing6/Noosphere/tree/HEAD/shared_skills/active/windows-npm-run-script-shell)
- [License: Apache-2.0](https://github.com/JinNing6/Noosphere/tree/HEAD/shared_skills/active/windows-npm-run-script-shell)

## Features

- **Shell failure triage:** Steps to tell an npm shell configuration problem apart from a real project build failure.
- **Direct tool comparison:** Runs the target tool with npx to confirm whether the failure comes from npm or the project.
- **Project-local npm config:** Suggests .npmrc settings for script-shell, cache location and notices that stay inside the repo.
- **Sandbox EPERM handling:** Explains how to handle npm cache and log write failures in restricted Windows workspaces.
- **PowerShell script caveats:** Notes that Windows PowerShell 5 does not support && in package scripts.

## Good for

- Fix npm test exiting with ERR_INVALID_ARG_TYPE on Windows
- Make npm run build work when npx tsc passes directly
- Stop npm cache EPERM errors in a sandboxed Windows project
- Set a project-local script-shell for npm scripts on Windows
- Find out why npm run prints no output on Windows

## Install

### Claude Code

Copy the skill folder to `~/.claude/skills/windows-npm-run-script-shell` to use it in all your projects:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/JinNing6/Noosphere.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/windows-npm-run-script-shell &&
cp -R "$tmp/shared_skills/active/windows-npm-run-script-shell" ~/.claude/skills/windows-npm-run-script-shell &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/windows-npm-run-script-shell` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/windows-npm-run-script-shell` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/JinNing6/Noosphere.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/windows-npm-run-script-shell &&
cp -R "$tmp/shared_skills/active/windows-npm-run-script-shell" ~/.agents/skills/windows-npm-run-script-shell &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/windows-npm-run-script-shell` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/windows-npm-run-script-shell` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/JinNing6/Noosphere.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/windows-npm-run-script-shell &&
cp -R "$tmp/shared_skills/active/windows-npm-run-script-shell" ~/.cursor/skills/windows-npm-run-script-shell &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/windows-npm-run-script-shell` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/JinNing6/Noosphere.git --path shared_skills/active/windows-npm-run-script-shell
```

Or copy the folder to `~/.gemini/skills/windows-npm-run-script-shell` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/windows-npm-run-script-shell`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/JinNing6/Noosphere.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/windows-npm-run-script-shell &&
cp -R "$tmp/shared_skills/active/windows-npm-run-script-shell" ~/.copilot/skills/windows-npm-run-script-shell &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/windows-npm-run-script-shell` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/JinNing6/Noosphere.git
```

Then copy `Noosphere/shared_skills/active/windows-npm-run-script-shell` into your agent's skills folder as `windows-npm-run-script-shell`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Windows NPM run script shell trigger?

It applies when Windows npm run, npm test, npm run build or npm run-script exits before running the script, with errors such as ERR_INVALID_ARG_TYPE, missing ComSpec, broken script-shell, or EPERM in the npm cache or log directory.

### Does Windows NPM run script shell change global npm settings?

Its guidance is to prefer a project-local .npmrc and to avoid global npm config changes unless the user asks for machine-wide changes.

### Does Windows NPM run script shell include scripts or extra files?

No. The folder contains only the SKILL.md file, with no bundled scripts.

### Does Windows NPM run script shell require a specific AI client?

The skill is a plain SKILL.md folder with no client-specific hooks or plugin packaging, so it follows the shared agent skills format.

### How do I install Windows NPM run script shell in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/windows-npm-run-script-shell to use it in all your projects, or to .claude/skills/windows-npm-run-script-shell in one project.

### Does Windows NPM run script shell run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Windows NPM run script shell?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Windows NPM run script shell?

The closest alternatives to Windows NPM run script shell are Use pnpm, Sandbox NPM install, Debugging and error recovery, Windows child process lifecycle and CLI install.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Use pnpm](https://ai-powered.com/skills/use-pnpm): Use pnpm is an open-source agent skill for developer tools.
- [Sandbox NPM install](https://ai-powered.com/skills/sandbox-npm-install): Sandbox NPM install is an open-source agent skill for developer tools.
- [Debugging and error recovery](https://ai-powered.com/skills/debugging-and-error-recovery): Debugging and error recovery is an open-source agent skill for developer tools.
- [Windows child process lifecycle](https://ai-powered.com/skills/windows-child-process-lifecycle): Windows child process lifecycle is an open-source agent skill for developer tools.
- [CLI install](https://ai-powered.com/skills/cli-install): CLI install is an open-source agent skill for developer tools.
- [Cleanup agent team node processes](https://ai-powered.com/skills/cleanup-agent-team-node-processes): Cleanup agent team node processes is an open-source agent skill for developer tools.
- [Batch files](https://ai-powered.com/skills/batch-files): Batch files is an open-source agent skill for files and documents.
- [Azure microsoft playwright testing ts](https://ai-powered.com/skills/azure-microsoft-playwright-testing-ts): Azure microsoft playwright testing ts is an open-source agent skill for browser automation.

---
Source: https://ai-powered.com/skills/windows-npm-run-script-shell
