NPM.EnvCheck (NPM v0.6.0)

Copy Markdown View Source

Environment checks for npm_ex.

Detects available Node.js installations, npm configuration, and checks compatibility with package engine requirements.

Summary

Functions

Check if a package's engine requirements are met.

Check if Node.js is available on the system PATH.

Get a summary of the current environment.

Functions

check_engines(engines)

@spec check_engines(%{required(String.t()) => String.t()}) ::
  :ok | {:warn, [String.t()]}

Check if a package's engine requirements are met.

Compares the engines field from package.json against the currently available Node.js version.

node_version()

@spec node_version() :: {:ok, String.t()} | :not_found

Check if Node.js is available on the system PATH.

Returns {:ok, version} or :not_found.

summary()

@spec summary() :: map()

Get a summary of the current environment.

Returns a map with system info relevant to npm operations.