npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yarn-tool/fnm-detect

v1.0.5

Published

fnm (Fast Node Manager) 環境偵測模組 / A module for detecting whether the current Node.js process is running within an fnm-managed environment

Readme

@yarn-tool/fnm-detect

fnm (Fast Node Manager) 環境偵測模組,用於偵測當前 Node.js 程序是否在 fnm 管理的環境中執行。 A module for detecting whether the current Node.js process is running within an fnm-managed environment.

安裝 (Installation)

# 使用 yarn / Using yarn
yarn add @yarn-tool/fnm-detect

# 使用 yarn-tool / Using yarn-tool
yarn-tool add @yarn-tool/fnm-detect
# yt 是 yarn-tool 的別名 / yt is an alias for yarn-tool
yt add @yarn-tool/fnm-detect

# 使用 pnpm / Using pnpm
pnpm add @yarn-tool/fnm-detect

# 使用 npm / Using npm
npm install @yarn-tool/fnm-detect

使用範例 (Usage Example)

import {
  detectFnmByExecPath,
  detectFnmByEnv,
  detectFnmByAll,
  isFNM
} from '@yarn-tool/fnm-detect';

// 簡單檢查是否在 fnm 環境中 / Simple check for fnm environment
if (isFNM()) {
  console.log('Running under fnm');
}

// 透過 execPath 偵測 / Detect via execPath
const result = detectFnmByExecPath();
console.log(result);
// {
//   isFnm: true,
//   detectedBy: 'execpath',
//   fnmPathType: 'fnm_multishells',
//   fnmPath: 'C:/Users/User/AppData/Local/fnm_multishells/20128_1771488837711',
//   fnmPathReal: 'C:/Users/User/AppData/Roaming/fnm/node-versions/v24.13.1/installation',
//   fnmDir: 'C:/Users/User/AppData/Roaming/fnm',
//   multishellKey: '20128_1771488837711',
//   version: 'v24.13.1',
//   ...
// }

// 透過環境變數偵測 / Detect via environment variables
const envResult = detectFnmByEnv(process.env);

// 結合兩種偵測方式 / Combine both detection methods
const allResult = detectFnmByAll();
console.log(allResult.detectedBy); // ['execpath', 'env'] 或 ['execpath'] 或 ['env'] 或 []

API

detectFnmByExecPath(execPath?, nodeVersion?)

透過 Node.js 執行檔路徑偵測 fnm 環境。

detectFnmByEnv(env?, nodeVersion?)

透過環境變數 (FNM_DIR, FNM_MULTISHELL_PATH) 偵測 fnm 環境。

detectFnmByAll(pc?)

同時使用 execPath 與環境變數兩種方式偵測。

isFNM()

簡單檢查當前程序是否在 fnm 下執行,返回布林值。

detectFnmPathType(fnmPath, inDeep?)

分析 fnm 路徑類型 (fnm_multishells, aliases, node-versions)。

回傳結果類型 (Result Types)

IDetectFnmByResult

| 屬性 | 說明 / Description | |------|-------------------| | isFnm | 是否偵測到 fnm 環境 / Whether fnm is detected | | detectedBy | 偵測來源 (execpath/env) / Detection source | | fnmPathType | 路徑類型 / Path type | | fnmPath | fnm 路徑 / fnm path | | fnmPathReal | 真實路徑(解析符號連結後)/ Real path after resolving symlinks | | fnmDir | fnm 主目錄 / fnm main directory | | multishellPath | Multishell 路徑 / Multishell path | | multishellKey | Multishell 鍵值 / Multishell key | | version | Node.js 版本 / Node.js version | | installationPath | 安裝路徑 / Installation path | | aliasDefaultPath | 預設別名路徑 / Default alias path |

License

ISC